DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_FCE_SHD

Source


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