DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HTC_SHD

Source


1 Package Body hxc_htc_shd as
2 /* $Header: hxchtcrhi.pkb 120.2.12010000.2 2008/08/05 12:03:17 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_htc_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 >---------------------------|
25 -- ----------------------------------------------------------------------------
26 Procedure constraint_error
27   (p_constraint_name in all_constraints.constraint_name%TYPE
28   ) Is
29 --
30   l_proc 	varchar2(72) := g_package||'constraint_error';
31 --
32 Begin
33   --
34   If (p_constraint_name = 'HXC_TIME_CATEGORIES_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_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_id
63       ,time_category_name
64       ,operator
65       ,description
66       ,display
67       ,object_version_number
68     from	hxc_time_categories
69     where	time_category_id = p_time_category_id;
70 --
71   l_fct_ret	boolean;
72 --
73 Begin
74   --
75   If (p_time_category_id is null and
76       p_object_version_number is null
77      ) Then
78     --
79     -- One of the primary key arguments is null therefore we must
80     -- set the returning function value to false
81     --
82     l_fct_ret := false;
83   Else
84     If (p_time_category_id
85         = hxc_htc_shd.g_old_rec.time_category_id and
86         p_object_version_number
87         = hxc_htc_shd.g_old_rec.object_version_number
88        ) Then
89       --
90       -- The g_old_rec is current therefore we must
91       -- set the returning function to true
92       --
93       l_fct_ret := true;
94     Else
95       --
96       -- Select the current row into g_old_rec
97       --
98       Open C_Sel1;
99       Fetch C_Sel1 Into hxc_htc_shd.g_old_rec;
100       If C_Sel1%notfound Then
101         Close C_Sel1;
102         --
103         -- The primary key is invalid therefore we must error
104         --
105         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
106         fnd_message.raise_error;
107       End If;
108       Close C_Sel1;
109       If (p_object_version_number
110           <> hxc_htc_shd.g_old_rec.object_version_number) Then
111         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
112         fnd_message.raise_error;
113       End If;
114       l_fct_ret := true;
115     End If;
116   End If;
117   Return (l_fct_ret);
118 --
119 End api_updating;
120 --
121 -- ----------------------------------------------------------------------------
122 -- |---------------------------------< lck >----------------------------------|
123 -- ----------------------------------------------------------------------------
124 Procedure lck
125   (p_time_category_id                           in     number
126   ,p_object_version_number                in     number
127   ) is
128 --
129 -- Cursor selects the 'current' row from the HR Schema
130 --
131   Cursor C_Sel1 is
132     select
133        time_category_id
134       ,time_category_name
135       ,operator
136       ,description
137       ,display
138       ,object_version_number
139     from	hxc_time_categories
140     where	time_category_id = p_time_category_id
141     for	update nowait;
142 --
143   l_proc	varchar2(72);
144 --
145 Begin
146   g_debug := hr_utility.debug_enabled;
147 
148   if g_debug then
149   	l_proc := g_package||'lck';
150   	hr_utility.set_location('Entering:'||l_proc, 5);
151   end if;
152   --
153   hr_api.mandatory_arg_error
154     (p_api_name           => l_proc
155     ,p_argument           => 'TIME_CATEGORY_ID'
156     ,p_argument_value     => p_time_category_id
157     );
158   --
159   Open  C_Sel1;
160   Fetch C_Sel1 Into hxc_htc_shd.g_old_rec;
161   If C_Sel1%notfound then
162     Close C_Sel1;
163     --
164     -- The primary key is invalid therefore we must error
165     --
166     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
167     fnd_message.raise_error;
168   End If;
169   Close C_Sel1;
170   If (p_object_version_number
171       <> hxc_htc_shd.g_old_rec.object_version_number) Then
172         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
173         fnd_message.raise_error;
174   End If;
175   --
176   if g_debug then
177   	hr_utility.set_location(' Leaving:'||l_proc, 10);
178   end if;
179   --
180   -- We need to trap the ORA LOCK exception
181   --
182 Exception
183   When HR_Api.Object_Locked then
184     --
185     -- The object is locked therefore we need to supply a meaningful
186     -- error message.
187     --
188     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
189     fnd_message.set_token('TABLE_NAME', 'hxc_time_categories');
190     fnd_message.raise_error;
191 End lck;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< convert_args >-----------------------------|
195 -- ----------------------------------------------------------------------------
196 Function convert_args
197   (p_time_category_id                     in number
198   ,p_time_category_name                   in varchar2
199   ,p_operator                       in     varchar2
200   ,p_description                    in     varchar2
201   ,p_display                        in     varchar2
202   ,p_object_version_number          in number
203   )
204   Return g_rec_type is
205 --
206   l_rec   g_rec_type;
207 --
208 Begin
209   --
210   -- Convert arguments into local l_rec structure.
211   --
212   l_rec.time_category_id                 := p_time_category_id;
213   l_rec.time_category_name               := p_time_category_name;
214   l_rec.operator                         := p_operator;
215   l_rec.description                      := p_description;
216   l_rec.display                          := p_display;
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_htc_shd;