DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_GDS_SHD

Source


1 Package Body pqp_gds_shd as
2 /* $Header: pqgdsrhi.pkb 120.0 2005/10/28 07:32 rvishwan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqp_gds_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'PQP_GAP_DURATION_SUMMARY_PK') 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','5');
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_gap_duration_summary_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 HR Schema
57   --
58   Cursor C_Sel1 is
59     select
60        gap_duration_summary_id
61       ,assignment_id
62       ,gap_absence_plan_id
63       ,summary_type
64       ,gap_level
65       ,duration_in_days
66       ,duration_in_hours
67       ,date_start
68       ,date_end
69       ,object_version_number
70     from        pqp_gap_duration_summary
71     where       gap_duration_summary_id = p_gap_duration_summary_id;
72   --
73   l_fct_ret     boolean;
74   --
75 Begin
76   --
77   If (p_gap_duration_summary_id is null and
78       p_object_version_number is null
79      ) Then
80     --
81     -- One of the primary key arguments is null therefore we must
82     -- set the returning function value to false
83     --
84     l_fct_ret := false;
85   Else
86     If (p_gap_duration_summary_id
87         = pqp_gds_shd.g_old_rec.gap_duration_summary_id and
88         p_object_version_number
89         = pqp_gds_shd.g_old_rec.object_version_number
90        ) Then
91       --
92       -- The g_old_rec is current therefore we must
93       -- set the returning function to true
94       --
95       l_fct_ret := true;
96     Else
97       --
98       -- Select the current row into g_old_rec
99       --
100       Open C_Sel1;
101       Fetch C_Sel1 Into pqp_gds_shd.g_old_rec;
102       If C_Sel1%notfound Then
103         Close C_Sel1;
104         --
105         -- The primary key is invalid therefore we must error
106         --
107         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
108         fnd_message.raise_error;
109       End If;
110       Close C_Sel1;
111       If (p_object_version_number
112           <> pqp_gds_shd.g_old_rec.object_version_number) Then
113         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
114         fnd_message.raise_error;
115       End If;
116       l_fct_ret := true;
117     End If;
118   End If;
119   Return (l_fct_ret);
120 --
121 End api_updating;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |---------------------------------< lck >----------------------------------|
125 -- ----------------------------------------------------------------------------
126 Procedure lck
127   (p_gap_duration_summary_id              in     number
128   ,p_object_version_number                in     number
129   ) is
130 --
131 -- Cursor selects the 'current' row from the HR Schema
132 --
133   Cursor C_Sel1 is
134     select
135        gap_duration_summary_id
136       ,assignment_id
137       ,gap_absence_plan_id
138       ,summary_type
139       ,gap_level
140       ,duration_in_days
141       ,duration_in_hours
142       ,date_start
143       ,date_end
144       ,object_version_number
145     from        pqp_gap_duration_summary
146     where       gap_duration_summary_id = p_gap_duration_summary_id
147     for update nowait;
148 --
149   l_proc        varchar2(72) := g_package||'lck';
150 --
151 Begin
152   hr_utility.set_location('Entering:'||l_proc, 5);
153   --
154   hr_api.mandatory_arg_error
155     (p_api_name           => l_proc
156     ,p_argument           => 'GAP_DURATION_SUMMARY_ID'
157     ,p_argument_value     => p_gap_duration_summary_id
158     );
159   hr_utility.set_location(l_proc,6);
160   hr_api.mandatory_arg_error
161     (p_api_name           => l_proc
162     ,p_argument           => 'OBJECT_VERSION_NUMBER'
163     ,p_argument_value     => p_object_version_number
164     );
165   --
166   Open  C_Sel1;
167   Fetch C_Sel1 Into pqp_gds_shd.g_old_rec;
168   If C_Sel1%notfound then
169     Close C_Sel1;
170     --
171     -- The primary key is invalid therefore we must error
172     --
173     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
174     fnd_message.raise_error;
175   End If;
176   Close C_Sel1;
177   If (p_object_version_number
178       <> pqp_gds_shd.g_old_rec.object_version_number) Then
179         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
180         fnd_message.raise_error;
181   End If;
182   --
183   hr_utility.set_location(' Leaving:'||l_proc, 10);
184   --
185   -- We need to trap the ORA LOCK exception
186   --
187 Exception
188   When HR_Api.Object_Locked then
189     --
190     -- The object is locked therefore we need to supply a meaningful
191     -- error message.
192     --
193     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
194     fnd_message.set_token('TABLE_NAME', 'pqp_gap_duration_summary');
195     fnd_message.raise_error;
196 End lck;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |-----------------------------< convert_args >-----------------------------|
200 -- ----------------------------------------------------------------------------
201 Function convert_args
202   (p_gap_duration_summary_id        in number
203   ,p_assignment_id                  in number
204   ,p_gap_absence_plan_id            in number
205   ,p_summary_type                   in varchar2
206   ,p_gap_level                      in varchar2
207   ,p_duration_in_days               in number
208   ,p_duration_in_hours              in number
209   ,p_date_start                     in date
210   ,p_date_end                       in date
211   ,p_object_version_number          in number
212   )
213   Return g_rec_type is
214 --
215   l_rec   g_rec_type;
216 --
217 Begin
218   --
219   -- Convert arguments into local l_rec structure.
220   --
221   l_rec.gap_duration_summary_id          := p_gap_duration_summary_id;
222   l_rec.assignment_id                    := p_assignment_id;
223   l_rec.gap_absence_plan_id              := p_gap_absence_plan_id;
224   l_rec.summary_type                     := p_summary_type;
225   l_rec.gap_level                        := p_gap_level;
226   l_rec.duration_in_days                 := p_duration_in_days;
227   l_rec.duration_in_hours                := p_duration_in_hours;
228   l_rec.date_start                       := p_date_start;
229   l_rec.date_end                         := p_date_end;
230   l_rec.object_version_number            := p_object_version_number;
231   --
232   -- Return the plsql record structure.
233   --
234   Return(l_rec);
235 --
236 End convert_args;
237 --
238 end pqp_gds_shd;