DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_FNS_SHD

Source


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