DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_UCX_SHD

Source


1 Package Body hr_ucx_shd as
2 /* $Header: hrucxrhi.pkb 120.0 2005/05/31 03:38:00 appldev noship $ */
3 
4 --
5 -- ----------------------------------------------------------------------------
6 -- |                     Private Global Definitions                           |
7 -- ----------------------------------------------------------------------------
8 --
9 g_package  varchar2(33) := '  hr_ucx_shd.';  -- Global package name
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15   (p_constraint_name in all_constraints.constraint_name%TYPE
16   ) Is
17 --
18   l_proc        varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21   --
22   If (p_constraint_name = 'SYS_C00164367') Then
23     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24     fnd_message.set_token('PROCEDURE', l_proc);
25     fnd_message.set_token('STEP','5');
26     fnd_message.raise_error;
27   Else
28     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31     fnd_message.raise_error;
32   End If;
33   --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40   (p_ui_context_id                        in     number
41   ,p_object_version_number                in     number
42   )
43   Return Boolean Is
44   --
45   --
46   -- Cursor selects the 'current' row from the HR Schema
47   --
48   Cursor C_Sel1 is
49     select
50        ui_context_id
51       ,ui_context_key
52       ,user_interface_id
53       ,label
54       ,location
55       ,object_version_number
56     from        hr_ki_ui_contexts
57     where       ui_context_id = p_ui_context_id;
58   --
59   l_fct_ret     boolean;
60   --
61 Begin
62   --
63   If (p_ui_context_id is null and
64       p_object_version_number is null
65      ) Then
66     --
67     -- One of the primary key arguments is null therefore we must
68     -- set the returning function value to false
69     --
70     l_fct_ret := false;
71   Else
72     If (p_ui_context_id
73         = hr_ucx_shd.g_old_rec.ui_context_id and
74         p_object_version_number
75         = hr_ucx_shd.g_old_rec.object_version_number
76        ) Then
77       --
78       -- The g_old_rec is current therefore we must
79       -- set the returning function to true
80       --
81       l_fct_ret := true;
82     Else
83       --
84       -- Select the current row into g_old_rec
85       --
86       Open C_Sel1;
87       Fetch C_Sel1 Into hr_ucx_shd.g_old_rec;
88       If C_Sel1%notfound Then
89         Close C_Sel1;
90         --
91         -- The primary key is invalid therefore we must error
92         --
93         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
94         fnd_message.raise_error;
95       End If;
96       Close C_Sel1;
97       If (p_object_version_number
98           <> hr_ucx_shd.g_old_rec.object_version_number) Then
99         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
100         fnd_message.raise_error;
101       End If;
102       l_fct_ret := true;
103     End If;
104   End If;
105   Return (l_fct_ret);
106 --
107 End api_updating;
108 
109 --
110 -- ----------------------------------------------------------------------------
111 -- |---------------------------------< lck >----------------------------------|
112 -- ----------------------------------------------------------------------------
113 Procedure lck
114   (p_ui_context_id                        in     number
115   ,p_object_version_number                in     number
116   ) is
117 --
118 -- Cursor selects the 'current' row from the HR Schema
119 --
120   Cursor C_Sel1 is
121     select
122        ui_context_id
123       ,ui_context_key
124       ,user_interface_id
125       ,label
126       ,location
127       ,object_version_number
128     from        hr_ki_ui_contexts
129     where       ui_context_id = p_ui_context_id
130     for update nowait;
131 --
132   l_proc        varchar2(72) := g_package||'lck';
133 --
134 Begin
135   hr_utility.set_location('Entering:'||l_proc, 5);
136   --
137   hr_api.mandatory_arg_error
138     (p_api_name           => l_proc
139     ,p_argument           => 'UI_CONTEXT_ID'
140     ,p_argument_value     => p_ui_context_id
141     );
142   hr_utility.set_location(l_proc,6);
143   hr_api.mandatory_arg_error
144     (p_api_name           => l_proc
145     ,p_argument           => 'OBJECT_VERSION_NUMBER'
146     ,p_argument_value     => p_object_version_number
147     );
148   --
149   Open  C_Sel1;
150   Fetch C_Sel1 Into hr_ucx_shd.g_old_rec;
151   If C_Sel1%notfound then
152     Close C_Sel1;
153     --
154     -- The primary key is invalid therefore we must error
155     --
156     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157     fnd_message.raise_error;
158   End If;
159   Close C_Sel1;
160   If (p_object_version_number
161       <> hr_ucx_shd.g_old_rec.object_version_number) Then
162         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163         fnd_message.raise_error;
164   End If;
165   --
166   hr_utility.set_location(' Leaving:'||l_proc, 10);
167   --
168   -- We need to trap the ORA LOCK exception
169   --
170 Exception
171   When HR_Api.Object_Locked then
172     --
173     -- The object is locked therefore we need to supply a meaningful
174     -- error message.
175     --
176     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
177     fnd_message.set_token('TABLE_NAME', 'hr_ki_ui_contexts');
178     fnd_message.raise_error;
179 End lck;
180 --
181 -- ----------------------------------------------------------------------------
182 -- |-----------------------------< convert_args >-----------------------------|
183 -- ----------------------------------------------------------------------------
184 Function convert_args
185   (p_ui_context_id                  in number
186   ,p_ui_context_key                 in varchar2
187   ,p_user_interface_id              in number
188   ,p_label                          in varchar2
189   ,p_location                       in varchar2
190   ,p_object_version_number          in number
191   )
192   Return g_rec_type is
193 --
194   l_rec   g_rec_type;
195 --
196 Begin
197   --
198   -- Convert arguments into local l_rec structure.
199   --
200   l_rec.ui_context_id                    := p_ui_context_id;
201   l_rec.ui_context_key                   := p_ui_context_key;
202   l_rec.user_interface_id                := p_user_interface_id;
203   l_rec.label                            := p_label;
204   l_rec.location                         := p_location;
205   l_rec.object_version_number            := p_object_version_number;
206   --
207   -- Return the plsql record structure.
208   --
209   Return(l_rec);
210 --
211 End convert_args;
212 --
213 
214 
215 -- ----------------------------------------------------------------------------
216 -- --------------------< CONSTRUCT_UI_CONTEXT_KEY>----------------------------|
217 -- ----------------------------------------------------------------------------
218 -- {Start Of Comments}
219 --
220 -- Description:
221 --   This procedure derives the ui_context_key.
222 --         UI_KEY + :: + label
223 --
224 -- Pre Conditions:
225 --   g_rec has been populated with details of the values
226 --   from the ins or the upd procedures
227 --
228 -- In Arguments:
229 --  user_interface_id ,label
230 --
231 --  Out
232 --  p_ui_context_key
233 --
234 -- Post Success:
235 --   Processing continues by returning key.
236 --
237 -- Post Failure:
238 --
239 -- {End Of Comments}
240 -- ----------------------------------------------------------------------------
241 procedure construct_ui_context_key
242 (
243    p_user_interface_id       in number
244   ,p_label                     in varchar2
245   ,p_ui_context_key out nocopy varchar2
246 )
247 is
248   --
249   -- Declare cursors and local variables
250   --
251 
252   -- Variables for API Boolean parameters
253   l_proc            varchar2(72) := g_package ||'construct_ui_context_key';
254   l_found           varchar2(10);
255   l_ui_key          varchar2(150);
256   cursor csr_key is
257          select user_interface_key
258            from hr_ki_user_interfaces
259           where  user_interface_id = p_user_interface_id;
260 --
261 
262   Begin
263     hr_utility.set_location(' Entering:' || l_proc,10);
264     --get the UI Key first
265     open csr_key;
266     fetch csr_key into l_ui_key;
267     close csr_key;
268 
269     p_ui_context_key := l_ui_key || '::' || p_label;
270 
271   --
272     hr_utility.set_location(' Leaving:' || l_proc,20);
273 
274 End construct_ui_context_key ;
275 
276 
277 
278 end hr_ucx_shd;