DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULA_SHD

Source


1 Package Body hxc_ula_shd as
2 /* $Header: hxcularhi.pkb 120.3 2005/09/23 05:57:47 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ula_shd.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
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 = 'HXC_LAYOUTS_PK') 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   ElsIf (p_constraint_name = 'HXC_LAYOUTS_UK1') Then
28     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('STEP','10');
31     fnd_message.raise_error;
32   Else
33     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
36     fnd_message.raise_error;
37   End If;
38   --
39 End constraint_error;
40 --
41 -- ----------------------------------------------------------------------------
42 -- |-----------------------------< api_updating >-----------------------------|
43 -- ----------------------------------------------------------------------------
44 Function api_updating
45   (p_layout_id                            in     number
46   ,p_object_version_number                in     number
47   )
48   Return Boolean Is
49 --
50   --
51   -- Cursor selects the 'current' row from the hxc Schema
52   --
53   Cursor C_Sel1 is
54     select
55        layout_id
56       ,layout_name
57       ,application_id
58       ,layout_type
59       ,modifier_level
60       ,modifier_value
61       ,top_level_region_code
62       ,object_version_number
63     from	hxc_layouts
64     where	layout_id = p_layout_id;
65 --
66   l_fct_ret	boolean;
67 --
68 Begin
69   --
70   If (p_layout_id is null and
71       p_object_version_number is null
72      ) Then
73     --
74     -- One of the primary key arguments is null therefore we must
75     -- set the returning function value to false
76     --
77     l_fct_ret := false;
78   Else
79     If (p_layout_id
80         = hxc_ula_shd.g_old_rec.layout_id and
81         p_object_version_number
82         = hxc_ula_shd.g_old_rec.object_version_number
83        ) Then
84       --
85       -- The g_old_rec is current therefore we must
86       -- set the returning function to true
87       --
88       l_fct_ret := true;
89     Else
90       --
91       -- Select the current row into g_old_rec
92       --
93       Open C_Sel1;
94       Fetch C_Sel1 Into hxc_ula_shd.g_old_rec;
95       If C_Sel1%notfound Then
96         Close C_Sel1;
97         --
98         -- The primary key is invalid therefore we must error
99         --
100         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
101         fnd_message.raise_error;
102       End If;
103       Close C_Sel1;
104       If (p_object_version_number
105           <> hxc_ula_shd.g_old_rec.object_version_number) Then
106         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
107         fnd_message.raise_error;
108       End If;
109       l_fct_ret := true;
110     End If;
111   End If;
112   Return (l_fct_ret);
113 --
114 End api_updating;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |---------------------------------< lck >----------------------------------|
118 -- ----------------------------------------------------------------------------
119 Procedure lck
120   (p_layout_id                            in     number
121   ,p_object_version_number                in     number
122   ) is
123 --
124 -- Cursor selects the 'current' row from the hxc Schema
125 --
126   Cursor C_Sel1 is
127     select
128        layout_id
129       ,layout_name
130       ,application_id
131       ,layout_type
132       ,modifier_level
133       ,modifier_value
134       ,top_level_region_code
135       ,object_version_number
136     from	hxc_layouts
137     where	layout_id = p_layout_id
138     for	update nowait;
139 --
140   l_proc	varchar2(72) ;
141 --
142 Begin
143   g_debug :=hr_utility.debug_enabled;
144   if g_debug then
145   	l_proc := g_package||'lck';
146   	hr_utility.set_location('Entering:'||l_proc, 5);
147   end if;
148   --
149   hr_api.mandatory_arg_error
150     (p_api_name           => l_proc
151     ,p_argument           => 'LAYOUT_ID'
152     ,p_argument_value     => p_layout_id
153     );
154   --
155   Open  C_Sel1;
156   Fetch C_Sel1 Into hxc_ula_shd.g_old_rec;
157   If C_Sel1%notfound then
158     Close C_Sel1;
159     --
160     -- The primary key is invalid therefore we must error
161     --
162     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
163     fnd_message.raise_error;
164   End If;
165   Close C_Sel1;
166   If (p_object_version_number
167       <> hxc_ula_shd.g_old_rec.object_version_number) Then
168         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
169         fnd_message.raise_error;
170   End If;
171   --
172   if g_debug then
173   	hr_utility.set_location(' Leaving:'||l_proc, 10);
174   end if;
175   --
176   -- We need to trap the ORA LOCK exception
177   --
178 Exception
179   When HR_Api.Object_Locked then
180     --
181     -- The object is locked therefore we need to supply a meaningful
182     -- error message.
183     --
184     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
185     fnd_message.set_token('TABLE_NAME', 'hxc_layouts');
186     fnd_message.raise_error;
187 End lck;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |-----------------------------< convert_args >-----------------------------|
191 -- ----------------------------------------------------------------------------
192 Function convert_args
193   (p_layout_id                      in number
194   ,p_layout_name                    in varchar2
195   ,p_application_id                 in number
196   ,p_layout_type                    in varchar2
197   ,p_modifier_level                 in varchar2
198   ,p_modifier_value                 in varchar2
199   ,p_top_level_region_code          in varchar2
200   ,p_object_version_number          in number
201   )
202   Return g_rec_type is
203 --
204   l_rec   g_rec_type;
205 --
206 Begin
207   --
208   -- Convert arguments into local l_rec structure.
209   --
210   l_rec.layout_id                        := p_layout_id;
211   l_rec.layout_name                      := p_layout_name;
212   l_rec.application_id                   := p_application_id;
213   l_rec.layout_type                      := p_layout_type;
214   l_rec.modifier_level                   := p_modifier_level;
215   l_rec.modifier_value                   := p_modifier_value;
216   l_rec.top_level_region_code            := p_top_level_region_code;
217   l_rec.object_version_number            := p_object_version_number;
218   --
219   -- Return the plsql record structure.
220   --
221   Return(l_rec);
222 --
223 End convert_args;
224 --
225 end hxc_ula_shd;