DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULP_SHD

Source


1 Package Body hxc_ulp_shd as
2 /* $Header: hxculprhi.pkb 120.2 2005/09/23 09:52:13 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ulp_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_LAYOUT_COMP_PROMPTS_FK1') 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_LAYOUT_COMP_PROMPTS_PK') 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   ElsIf (p_constraint_name = 'HXC_LAYOUT_COMP_PROMPTS_UK1') 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','15');
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_layout_comp_prompt_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 hxc Schema
57   --
58   Cursor C_Sel1 is
59     select
60        layout_comp_prompt_id
61       ,layout_component_id
62       ,prompt_alias
63       ,prompt_type
64       ,region_code
65       ,region_application_id
66       ,attribute_code
67       ,attribute_application_id
68       ,object_version_number
69     from	hxc_layout_comp_prompts
70     where	layout_comp_prompt_id = p_layout_comp_prompt_id;
71 --
72   l_fct_ret	boolean;
73 --
74 Begin
75   --
76   If (p_layout_comp_prompt_id is null and
77       p_object_version_number is null
78      ) Then
79     --
80     -- One of the primary key arguments is null therefore we must
81     -- set the returning function value to false
82     --
83     l_fct_ret := false;
84   Else
85     If (p_layout_comp_prompt_id
86         = hxc_ulp_shd.g_old_rec.layout_comp_prompt_id and
87         p_object_version_number
88         = hxc_ulp_shd.g_old_rec.object_version_number
89        ) Then
90       --
91       -- The g_old_rec is current therefore we must
92       -- set the returning function to true
93       --
94       l_fct_ret := true;
95     Else
96       --
97       -- Select the current row into g_old_rec
98       --
99       Open C_Sel1;
100       Fetch C_Sel1 Into hxc_ulp_shd.g_old_rec;
101       If C_Sel1%notfound Then
102         Close C_Sel1;
103         --
104         -- The primary key is invalid therefore we must error
105         --
106         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
107         fnd_message.raise_error;
108       End If;
109       Close C_Sel1;
110       If (p_object_version_number
111           <> hxc_ulp_shd.g_old_rec.object_version_number) Then
112         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
113         fnd_message.raise_error;
114       End If;
115       l_fct_ret := true;
116     End If;
117   End If;
118   Return (l_fct_ret);
119 --
120 End api_updating;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |---------------------------------< lck >----------------------------------|
124 -- ----------------------------------------------------------------------------
125 Procedure lck
126   (p_layout_comp_prompt_id                in     number
127   ,p_object_version_number                in     number
128   ) is
129 --
130 -- Cursor selects the 'current' row from the hxc Schema
131 --
132   Cursor C_Sel1 is
133     select
134        layout_comp_prompt_id
135       ,layout_component_id
136       ,prompt_alias
137       ,prompt_type
138       ,region_code
139       ,region_application_id
140       ,attribute_code
141       ,attribute_application_id
142       ,object_version_number
143     from	hxc_layout_comp_prompts
144     where	layout_comp_prompt_id = p_layout_comp_prompt_id
145     for	update nowait;
146 --
147   l_proc	varchar2(72) ;
148 --
149 Begin
150   g_debug :=hr_utility.debug_enabled;
151   if g_debug then
152   	l_proc := g_package||'lck';
153   	hr_utility.set_location('Entering:'||l_proc, 5);
154   end if;
155   --
156   hr_api.mandatory_arg_error
157     (p_api_name           => l_proc
158     ,p_argument           => 'LAYOUT_COMP_PROMPT_ID'
159     ,p_argument_value     => p_layout_comp_prompt_id
160     );
161   --
162   Open  C_Sel1;
163   Fetch C_Sel1 Into hxc_ulp_shd.g_old_rec;
164   If C_Sel1%notfound then
165     Close C_Sel1;
166     --
167     -- The primary key is invalid therefore we must error
168     --
169     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
170     fnd_message.raise_error;
171   End If;
172   Close C_Sel1;
173   If (p_object_version_number
174       <> hxc_ulp_shd.g_old_rec.object_version_number) Then
175         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
176         fnd_message.raise_error;
177   End If;
178   --
179   if g_debug then
180   	hr_utility.set_location(' Leaving:'||l_proc, 10);
181   end if;
182   --
183   -- We need to trap the ORA LOCK exception
184   --
185 Exception
186   When HR_Api.Object_Locked then
187     --
188     -- The object is locked therefore we need to supply a meaningful
189     -- error message.
190     --
191     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
192     fnd_message.set_token('TABLE_NAME', 'hxc_layout_comp_prompts');
193     fnd_message.raise_error;
194 End lck;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |-----------------------------< convert_args >-----------------------------|
198 -- ----------------------------------------------------------------------------
199 Function convert_args
200   (p_layout_comp_prompt_id          in number
201   ,p_layout_component_id            in number
202   ,p_prompt_alias                   in varchar2
203   ,p_prompt_type                    in varchar2
204   ,p_region_code                    in varchar2
205   ,p_region_application_id          in number
206   ,p_attribute_code                 in varchar2
207   ,p_attribute_application_id       in number
208   ,p_object_version_number          in number
209   )
210   Return g_rec_type is
211 --
212   l_rec   g_rec_type;
213 --
214 Begin
215   --
216   -- Convert arguments into local l_rec structure.
217   --
218   l_rec.layout_comp_prompt_id            := p_layout_comp_prompt_id;
219   l_rec.layout_component_id              := p_layout_component_id;
220   l_rec.prompt_alias                     := p_prompt_alias;
221   l_rec.prompt_type                      := p_prompt_type;
222   l_rec.region_code                      := p_region_code;
223   l_rec.region_application_id            := p_region_application_id;
224   l_rec.attribute_code                   := p_attribute_code;
225   l_rec.attribute_application_id         := p_attribute_application_id;
226   l_rec.object_version_number            := p_object_version_number;
227   --
228   -- Return the plsql record structure.
229   --
230   Return(l_rec);
231 --
232 End convert_args;
233 --
234 end hxc_ulp_shd;