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