DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ITF_SHD

Source


1 Package Body hr_itf_shd as
2 /* $Header: hritfrhi.pkb 120.0 2005/05/31 00:58:13 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_itf_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 = 'HR_KI_USER_INTERFACES_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_user_interface_id                    in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        user_interface_id
50       ,user_interface_key
51       ,type
52       ,form_name
53       ,page_region_code
54       ,region_code
55       ,object_version_number
56     from        hr_ki_user_interfaces
57     where       user_interface_id = p_user_interface_id;
58   --
59   l_fct_ret     boolean;
60   --
61 Begin
62   --
63   If (p_user_interface_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_user_interface_id
73         = hr_itf_shd.g_old_rec.user_interface_id and
74         p_object_version_number
75         = hr_itf_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_itf_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_itf_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 -- |---------------------------------< lck >----------------------------------|
111 -- ----------------------------------------------------------------------------
112 Procedure lck
113   (p_user_interface_id                    in     number
114   ,p_object_version_number                in     number
115   ) is
116 --
117 -- Cursor selects the 'current' row from the HR Schema
118 --
119   Cursor C_Sel1 is
120     select
121        user_interface_id
122       ,user_interface_key
123       ,type
124       ,form_name
125       ,page_region_code
126       ,region_code
127       ,object_version_number
128     from        hr_ki_user_interfaces
129     where       user_interface_id = p_user_interface_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           => 'USER_INTERFACE_ID'
140     ,p_argument_value     => p_user_interface_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_itf_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_itf_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_user_interfaces');
178     fnd_message.raise_error;
179 End lck;
180 --
181 -- ----------------------------------------------------------------------------
182 -- |-----------------------------< convert_args >-----------------------------|
183 -- ----------------------------------------------------------------------------
184 Function convert_args
185   (p_user_interface_id              in number
186   ,p_user_interface_key             in varchar2
187   ,p_type                           in varchar2
188   ,p_form_name                      in varchar2
189   ,p_page_region_code               in varchar2
190   ,p_region_code                    in varchar2
191   ,p_object_version_number          in number
192   )
193   Return g_rec_type is
194 --
195   l_rec   g_rec_type;
196 --
197 Begin
198   --
199   -- Convert arguments into local l_rec structure.
200   --
201   l_rec.user_interface_id                := p_user_interface_id;
202   l_rec.user_interface_key               := p_user_interface_key;
203   l_rec.type                             := p_type;
204   l_rec.form_name                        := p_form_name;
205   l_rec.page_region_code                 := p_page_region_code;
206   l_rec.region_code                      := p_region_code;
207   l_rec.object_version_number            := p_object_version_number;
208   --
209   -- Return the plsql record structure.
210   --
211   Return(l_rec);
212 --
213 End convert_args;
214 -- ----------------------------------------------------------------------------
215 -- --------------------< CONSTRUCT_USER_INTERFACE_KEY>-------------------------
216 -- ----------------------------------------------------------------------------
217 -- {Start Of Comments}
218 --
219 -- Description:
220 --   This procedure derives the user_interface key.
221 --         if type = form -> type + :: + form_name
222 --        if type = self service / portal -> type + :: + page_region_code +
223 --        :: + region_code
224 --
225 -- Pre Conditions:
226 --   g_rec has been populated with details of the values
227 --   from the ins or the upd procedures
228 --
229 -- In Arguments:
230 --  p_type ,p_form_name
231 --  p_page_region_code , p_region_code
232 --
233 --  Out
234 --  p_user_interface_key
235 --
236 -- Post Success:
237 --   Processing continues by returning key.
238 --
239 -- Post Failure:
240 --
241 -- {End Of Comments}
242 -- ----------------------------------------------------------------------------
243 procedure construct_user_interface_key
244 (
245    p_type               in varchar2
246   ,p_form_name          in varchar2
247   ,p_page_region_code   in varchar2
248   ,p_region_code        in varchar2
249   ,p_user_interface_key out nocopy varchar2
250 )
251 is
252   --
253   -- Declare cursors and local variables
254   --
255   l_key_total_length    number := 150;
256   --
257   -- Variables for API Boolean parameters
258   --
259   l_proc            varchar2(72) := g_package ||'construct_user_interface_key';
260   l_found           varchar2(10);
261   l_form_const  varchar2(5) := 'PUI';
262   l_ss_const  varchar2(5) := 'SS';
263   l_portal_const  varchar2(5) := 'P';
264 
265 
266   Begin
267     hr_utility.set_location(' Entering:' || l_proc,10);
268 
269   if (p_type=l_form_const) then
270 
271     p_user_interface_key := p_type || '::' || p_form_name;
272 
273   elsif ((p_type=l_ss_const or p_type=l_portal_const) and p_region_code is null) then
274 
275     p_user_interface_key := p_type || '::' ||
276                               substr(p_page_region_code
277                                     ,1
278                                     ,l_key_total_length - length(p_type) - 2
279                                     );
280 
281   else
282    p_user_interface_key :=
283      p_type || '::' ||
284      substr(p_page_region_code
285            ,1
286            ,l_key_total_length - length(p_type) - length(p_region_code) - 4
287            ) || '::'||
288            p_region_code;
289    end if;
290 
291 
292   --
293     hr_utility.set_location(' Leaving:' || l_proc,20);
294 
295 End construct_user_interface_key ;
296 --
297 end hr_itf_shd;