[Home] [Help]
PACKAGE BODY: APPS.OTA_FTU_SHD
Source
1 Package Body ota_ftu_shd as
2 /* $Header: otfturhi.pkb 120.1 2005/09/21 02:31 aabalakr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_ftu_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 If (p_constraint_name = 'OTA_PVT_FRM_THREAD_USERS_PK1') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_forum_thread_id in number
40 ,p_forum_id in number
41 ,p_person_id in number
42 ,p_contact_id in number
43 ,p_object_version_number in number
44 )
45 Return Boolean Is
46 --
47 --
48 -- Cursor selects the 'current' row from the HR Schema
49 --
50 Cursor C_Sel1 is
51 select
52 forum_thread_id
53 ,forum_id
54 ,business_group_id
55 ,author_person_id
56 ,author_contact_id
57 ,person_id
58 ,contact_id
59 ,object_version_number
60 from ota_pvt_frm_thread_users
61 where forum_thread_id = p_forum_thread_id
62 and forum_id = p_forum_id
63 and person_id = p_person_id
64 and contact_id = p_contact_id;
65 --
66 l_fct_ret boolean;
67 --
68 Begin
69 --
70 If (p_forum_thread_id is null and
71 p_forum_id is null and
72 p_person_id is null and
73 p_contact_id is null and
74 p_object_version_number is null
75 ) Then
76 --
77 -- One of the primary key arguments is null therefore we must
78 -- set the returning function value to false
79 --
80 l_fct_ret := false;
81 Else
82 If (p_forum_thread_id
83 = ota_ftu_shd.g_old_rec.forum_thread_id and
84 p_forum_id
85 = ota_ftu_shd.g_old_rec.forum_id and
86 p_person_id
87 = ota_ftu_shd.g_old_rec.person_id and
88 p_contact_id
89 = ota_ftu_shd.g_old_rec.contact_id and
90 p_object_version_number
91 = ota_ftu_shd.g_old_rec.object_version_number
92 ) Then
93 --
94 -- The g_old_rec is current therefore we must
95 -- set the returning function to true
96 --
97 l_fct_ret := true;
98 Else
99 --
100 -- Select the current row into g_old_rec
101 --
102 Open C_Sel1;
103 Fetch C_Sel1 Into ota_ftu_shd.g_old_rec;
104 If C_Sel1%notfound Then
105 Close C_Sel1;
106 --
107 -- The primary key is invalid therefore we must error
108 --
109 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
110 fnd_message.raise_error;
111 End If;
112 Close C_Sel1;
113 If (p_object_version_number
114 <> ota_ftu_shd.g_old_rec.object_version_number) Then
115 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
116 fnd_message.raise_error;
117 End If;
118 l_fct_ret := true;
119 End If;
120 End If;
121 Return (l_fct_ret);
122 --
123 End api_updating;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------------< lck >----------------------------------|
127 -- ----------------------------------------------------------------------------
128 Procedure lck
129 (p_forum_thread_id in number
130 ,p_forum_id in number
131 ,p_person_id in number
132 ,p_contact_id in number
133 ,p_object_version_number in number
134 ) is
135 --
136 -- Cursor selects the 'current' row from the HR Schema
137 --
138 Cursor C_Sel1 is
139 select
140 forum_thread_id
141 ,forum_id
142 ,business_group_id
143 ,author_person_id
144 ,author_contact_id
145 ,person_id
146 ,contact_id
147 ,object_version_number
148 from ota_pvt_frm_thread_users
149 where forum_thread_id = p_forum_thread_id
150 and forum_id = p_forum_id
151 and (person_id is null or person_id = p_person_id)
152 and (contact_id is null or contact_id = p_contact_id)
153 for update nowait;
154 --
155 l_proc varchar2(72) := g_package||'lck';
156 --
157 Begin
158 hr_utility.set_location('Entering:'||l_proc, 5);
159 --
160 hr_api.mandatory_arg_error
161 (p_api_name => l_proc
162 ,p_argument => 'FORUM_THREAD_ID'
163 ,p_argument_value => p_forum_thread_id
164 );
165 hr_utility.set_location(l_proc,6);
166 hr_api.mandatory_arg_error
167 (p_api_name => l_proc
168 ,p_argument => 'FORUM_ID'
169 ,p_argument_value => p_forum_id
170 );
171 hr_utility.set_location(l_proc,7);
172 -- hr_api.mandatory_arg_error
173 -- (p_api_name => l_proc
174 -- ,p_argument => 'PERSON_ID'
175 -- ,p_argument_value => p_person_id
176 -- );
177 hr_utility.set_location(l_proc,8);
178 -- hr_api.mandatory_arg_error
179 -- (p_api_name => l_proc
180 -- ,p_argument => 'CONTACT_ID'
181 -- ,p_argument_value => p_contact_id
182 -- );
183 hr_utility.set_location(l_proc,9);
184 hr_api.mandatory_arg_error
185 (p_api_name => l_proc
186 ,p_argument => 'OBJECT_VERSION_NUMBER'
187 ,p_argument_value => p_object_version_number
188 );
189 --
190 Open C_Sel1;
191 Fetch C_Sel1 Into ota_ftu_shd.g_old_rec;
192 If C_Sel1%notfound then
193 Close C_Sel1;
194 --
195 -- The primary key is invalid therefore we must error
196 --
197 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
198 fnd_message.raise_error;
199 End If;
200 Close C_Sel1;
201 If (p_object_version_number
202 <> ota_ftu_shd.g_old_rec.object_version_number) Then
203 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
204 fnd_message.raise_error;
205 End If;
206 --
207 hr_utility.set_location(' Leaving:'||l_proc, 10);
208 --
209 -- We need to trap the ORA LOCK exception
210 --
211 Exception
212 When HR_Api.Object_Locked then
213 --
214 -- The object is locked therefore we need to supply a meaningful
215 -- error message.
216 --
217 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
218 fnd_message.set_token('TABLE_NAME', 'ota_pvt_frm_thread_users');
219 fnd_message.raise_error;
220 End lck;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |-----------------------------< convert_args >-----------------------------|
224 -- ----------------------------------------------------------------------------
225 Function convert_args
226 (p_forum_thread_id in number
227 ,p_forum_id in number
228 ,p_business_group_id in number
229 ,p_author_person_id in number
230 ,p_author_contact_id in number
231 ,p_person_id in number
232 ,p_contact_id in number
233 ,p_object_version_number in number
234 )
235 Return g_rec_type is
236 --
237 l_rec g_rec_type;
238 --
239 Begin
240 --
241 -- Convert arguments into local l_rec structure.
242 --
243 l_rec.forum_thread_id := p_forum_thread_id;
244 l_rec.forum_id := p_forum_id;
245 l_rec.business_group_id := p_business_group_id;
246 l_rec.author_person_id := p_author_person_id;
247 l_rec.author_contact_id := p_author_contact_id;
248 l_rec.person_id := p_person_id;
249 l_rec.contact_id := p_contact_id;
250 l_rec.object_version_number := p_object_version_number;
251 --
252 -- Return the plsql record structure.
253 --
254 Return(l_rec);
255 --
256 End convert_args;
257 --
258 end ota_ftu_shd;