DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ATC_SHD

Source


1 Package Body hxc_atc_shd as
2 /* $Header: hxcatcrhi.pkb 120.2 2005/09/23 08:06:56 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hxc_atc_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_ALIAS_TYPE_COMPONENTS_PK') Then
23     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24     fnd_message.set_token('PROCEDURE', l_proc);
28     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
25     fnd_message.set_token('STEP','5');
26     fnd_message.raise_error;
27   Else
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_alias_type_component_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        alias_type_component_id
51       ,component_name
52       ,component_type
53       ,mapping_component_id
54       ,alias_type_id
55       ,object_version_number
56     from        hxc_alias_type_components
57     where       alias_type_component_id = p_alias_type_component_id;
58   --
59   l_fct_ret     boolean;
60   --
61 Begin
62   --
63   If (p_alias_type_component_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_alias_type_component_id
73         = hxc_atc_shd.g_old_rec.alias_type_component_id and
74         p_object_version_number
75         = hxc_atc_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 hxc_atc_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           <> hxc_atc_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_alias_type_component_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        alias_type_component_id
122       ,component_name
123       ,component_type
124       ,mapping_component_id
125       ,alias_type_id
126       ,object_version_number
127     from        hxc_alias_type_components
128     where       alias_type_component_id = p_alias_type_component_id
129     for update nowait;
130 --
131   l_proc        varchar2(72);
132 --
133 Begin
134   g_debug:=hr_utility.debug_enabled;
135   if g_debug then
136 	l_proc := g_package||'lck';
137 	hr_utility.set_location('Entering:'||l_proc, 5);
138   end if;
139   --
140   hr_api.mandatory_arg_error
141     (p_api_name           => l_proc
142     ,p_argument           => 'ALIAS_TYPE_COMPONENT_ID'
143     ,p_argument_value     => p_alias_type_component_id
144     );
145   if g_debug then
146 	hr_utility.set_location(l_proc,6);
147   end if;
148   hr_api.mandatory_arg_error
149     (p_api_name           => l_proc
150     ,p_argument           => 'OBJECT_VERSION_NUMBER'
151     ,p_argument_value     => p_object_version_number
152     );
153   --
154   Open  C_Sel1;
155   Fetch C_Sel1 Into hxc_atc_shd.g_old_rec;
156   If C_Sel1%notfound then
157     Close C_Sel1;
158     --
159     -- The primary key is invalid therefore we must error
160     --
161     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
162     fnd_message.raise_error;
163   End If;
164   Close C_Sel1;
165   If (p_object_version_number
166       <> hxc_atc_shd.g_old_rec.object_version_number) Then
167         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
168         fnd_message.raise_error;
169   End If;
170   --
171   if g_debug then
172 	hr_utility.set_location(' Leaving:'||l_proc, 10);
173   end if;
174   --
175   -- We need to trap the ORA LOCK exception
176   --
177 Exception
178   When HR_Api.Object_Locked then
179     --
180     -- The object is locked therefore we need to supply a meaningful
181     -- error message.
182     --
183     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
184     fnd_message.set_token('TABLE_NAME', 'hxc_alias_type_components');
185     fnd_message.raise_error;
186 End lck;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< convert_args >-----------------------------|
190 -- ----------------------------------------------------------------------------
191 Function convert_args
192   (p_alias_type_component_id        in number
193   ,p_component_name                 in varchar2
194   ,p_component_type                 in varchar2
195   ,p_mapping_component_id           in number
196   ,p_alias_type_id                  in number
197   ,p_object_version_number          in number
198   )
199   Return g_rec_type is
200 --
201   l_rec   g_rec_type;
202 --
203 Begin
204   --
205   -- Convert arguments into local l_rec structure.
206   --
207   l_rec.alias_type_component_id          := p_alias_type_component_id;
208   l_rec.component_name                   := p_component_name;
209   l_rec.component_type                   := p_component_type;
210   l_rec.mapping_component_id             := p_mapping_component_id;
211   l_rec.alias_type_id                    := p_alias_type_id;
212   l_rec.object_version_number            := p_object_version_number;
213   --
214   -- Return the plsql record structure.
215   --
216   Return(l_rec);
217 --
218 End convert_args;
219 --
220 end hxc_atc_shd;