DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TCC_SHD

Source


1 Package Body hxc_tcc_shd as
2 /* $Header: hxctccrhi.pkb 120.3 2006/07/07 06:27:47 gsirigin noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_tcc_shd.';  -- Global package name
9 
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------< return_api_dml_status >-------------------------|
14 -- ----------------------------------------------------------------------------
15 Function return_api_dml_status Return Boolean Is
16 --
17 Begin
18   --
19   Return (nvl(g_api_dml, false));
20   --
21 End return_api_dml_status;
22 --
23 -- ----------------------------------------------------------------------------
24 -- |---------------------------< constraint_error >---------------------------|
28   ) Is
25 -- ----------------------------------------------------------------------------
26 Procedure constraint_error
27   (p_constraint_name in all_constraints.constraint_name%TYPE
29 --
30   l_proc 	varchar2(72) := g_package||'constraint_error';
31 --
32 Begin
33   --
34   If (p_constraint_name = 'HXC_MAPPING_COMPS_PK') Then
35     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
36     fnd_message.set_token('PROCEDURE', l_proc);
37     fnd_message.set_token('STEP','5');
38     fnd_message.raise_error;
39   Else
40     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
41     fnd_message.set_token('PROCEDURE', l_proc);
42     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
43     fnd_message.raise_error;
44   End If;
45   --
46 End constraint_error;
47 --
48 -- ----------------------------------------------------------------------------
49 -- |-----------------------------< api_updating >-----------------------------|
50 -- ----------------------------------------------------------------------------
51 Function api_updating
52   (p_time_category_comp_id                in     number
53   ,p_object_version_number                in     number
54   )
55   Return Boolean Is
56 --
57   --
58   -- Cursor selects the 'current' row from the HR Schema
59   --
60   Cursor C_Sel1 is
61     select
62            time_category_comp_id
63           ,time_category_id
64           ,ref_time_category_id
65           ,component_type_id
66           ,flex_value_set_id
67           ,value_id
68           ,is_null
69           ,equal_to
70           ,type
71           ,object_version_number
72     from	hxc_time_category_comps
73     where	time_category_comp_id = p_time_category_comp_id;
74 --
75   l_fct_ret	boolean;
76 --
77 Begin
78   --
79   If (p_time_category_comp_id is null and
80       p_object_version_number is null
81      ) Then
82 
83     -- One of the primary key arguments is null therefore we must
84     -- set the returning function value to false
85 
86     l_fct_ret := false;
87   Else
88     If (p_time_category_comp_id
89         = hxc_tcc_shd.g_old_rec.time_category_comp_id and
90         p_object_version_number
91         = hxc_tcc_shd.g_old_rec.object_version_number
92        ) Then
93       --
94       -- The g_old_rec is current therefore we must
95       -- set the returning function to true
96       --
97       l_fct_ret := true;
98     Else
99       --
100       -- Select the current row into g_old_rec
101       --
102       Open C_Sel1;
103       Fetch C_Sel1 Into hxc_tcc_shd.g_old_rec;
104       If C_Sel1%notfound Then
105         Close C_Sel1;
106         --
107         -- The primary key is invalid therefore we must error
108         --
109         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
110         fnd_message.raise_error;
111       End If;
112       Close C_Sel1;
113       If (p_object_version_number
114           <> hxc_tcc_shd.g_old_rec.object_version_number) Then
115         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
116         fnd_message.raise_error;
117       End If;
118       l_fct_ret := true;
119     End If;
120   End If;
121   Return (l_fct_ret);
122 --
123 End api_updating;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------------< lck >----------------------------------|
127 -- ----------------------------------------------------------------------------
128 Procedure lck
129   (p_time_category_comp_id                in     number
130   ,p_object_version_number                in     number
131   ) is
132 --
133 -- Cursor selects the 'current' row from the HR Schema
134 --
135   Cursor C_Sel1 is
136 
137     select
138            time_category_comp_id
139           ,time_category_id
140           ,ref_time_category_id
141           ,component_type_id
142           ,flex_value_set_id
143           ,value_id
144           ,is_null
145           ,equal_to
146           ,type
147           ,object_version_number
148     from	hxc_time_category_comps
149     where	time_category_comp_id = p_time_category_comp_id
150     for	update nowait;
151 --
152   l_proc	varchar2(72);
153 --
154 Begin
155   g_debug := hr_utility.debug_enabled;
156 
157   if g_debug then
158   	l_proc := g_package||'lck';
159   	hr_utility.set_location('Entering:'||l_proc, 5);
160   end if;
161   --
162   hr_api.mandatory_arg_error
163     (p_api_name           => l_proc
164     ,p_argument           => 'TIME_CATEGORY_COMP_ID'
165     ,p_argument_value     => p_time_category_comp_id
166     );
167   --
168   Open  C_Sel1;
169   Fetch C_Sel1 Into hxc_tcc_shd.g_old_rec;
170   If C_Sel1%notfound then
171     Close C_Sel1;
172     --
173     -- The primary key is invalid therefore we must error
174     --
175     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
176     fnd_message.raise_error;
177   End If;
178   Close C_Sel1;
179   If (p_object_version_number
180       <> hxc_tcc_shd.g_old_rec.object_version_number) Then
181         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
182         fnd_message.raise_error;
183   End If;
184   --
185   if g_debug then
189   -- We need to trap the ORA LOCK exception
186   	hr_utility.set_location(' Leaving:'||l_proc, 10);
187   end if;
188   --
190   --
191 Exception
192   When HR_Api.Object_Locked then
193     --
194     -- The object is locked therefore we need to supply a meaningful
195     -- error message.
196     --
197     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
198     fnd_message.set_token('TABLE_NAME', 'hxc_time_category_comps');
199     fnd_message.raise_error;
200 End lck;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |-----------------------------< convert_args >-----------------------------|
204 -- ----------------------------------------------------------------------------
205 Function convert_args
206   (
207    p_time_category_comp_id          in number
208   ,p_time_category_id               in number
209   ,p_ref_time_category_id           in number
210   ,p_component_type_id              in number
211   ,p_flex_value_set_id              in number
212   ,p_value_id                       in varchar2
213   ,p_is_null                        in varchar2
214   ,p_equal_to                       in varchar2
215   ,p_type                           in varchar2
216   ,p_object_version_number          in number
217   )
218   Return g_rec_type is
219 --
220   l_rec   g_rec_type;
221 --
222 Begin
223   --
224   -- Convert arguments into local l_rec structure.
225   --
226   l_rec.time_category_comp_id            := p_time_category_comp_id;
227   l_rec.time_category_id                 := p_time_category_id;
228   l_rec.ref_time_category_id             := p_ref_time_category_id;
229   l_rec.component_type_id                := p_component_type_id;
230   l_rec.flex_value_set_id                := p_flex_value_set_id;
231   l_rec.value_id                         := p_value_id;
232   l_rec.is_null                          := p_is_null;
233   l_rec.equal_to                         := p_equal_to;
234   l_rec.type                             := p_type;
235   l_rec.object_version_number            := p_object_version_number;
236   --
237   -- Return the plsql record structure.
238   --
239   Return(l_rec);
240 --
241 End convert_args;
242 --
243 end hxc_tcc_shd;