DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_AAD_SHD

Source


1 Package Body pqp_aad_shd as
2 /* $Header: pqaadrhi.pkb 115.5 2003/02/17 22:13:35 tmehra ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqp_aad_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'PQP_ANALYZED_ALIEN_DATA_PK') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   Else
42     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45     hr_utility.raise_error;
46   End If;
47   --
48   hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (
56   p_analyzed_data_id                   in number,
57   p_object_version_number              in number
58   )      Return Boolean Is
59 --
60   --
61   -- Cursor selects the 'current' row from the HR Schema
62   --
63   Cursor C_Sel1 is
64     select
65 	analyzed_data_id,
66 	assignment_id,
67 	data_source,
68 	tax_year,
69 	current_residency_status,
70 	nra_to_ra_date,
71 	target_departure_date,
72 	tax_residence_country_code,
73 	treaty_info_update_date,
74 	number_of_days_in_usa,
75 	withldg_allow_eligible_flag,
76 	ra_effective_date,
77 	record_source,
78 	visa_type,
79 	j_sub_type,
80 	primary_activity,
81 	non_us_country_code,
82 	citizenship_country_code,
83 	object_version_number	,
84         date_8233_signed,
85         date_w4_signed
86     from	pqp_analyzed_alien_data
87     where	analyzed_data_id = p_analyzed_data_id;
88 --
89   l_proc	varchar2(72)	:= g_package||'api_updating';
90   l_fct_ret	boolean;
91 --
92 Begin
93   hr_utility.set_location('Entering:'||l_proc, 5);
94   --
95   If (
96 	p_analyzed_data_id is null and
97 	p_object_version_number is null
98      ) Then
99     --
100     -- One of the primary key arguments is null therefore we must
101     -- set the returning function value to false
102     --
103     l_fct_ret := false;
104   Else
105     If (
106 	p_analyzed_data_id = g_old_rec.analyzed_data_id and
107 	p_object_version_number = g_old_rec.object_version_number
108        ) Then
109       hr_utility.set_location(l_proc, 10);
110       --
111       -- The g_old_rec is current therefore we must
112       -- set the returning function to true
113       --
114       l_fct_ret := true;
115     Else
116       --
117       -- Select the current row into g_old_rec
118       --
119       Open C_Sel1;
120       Fetch C_Sel1 Into g_old_rec;
121       If C_Sel1%notfound Then
122         Close C_Sel1;
123         --
124         -- The primary key is invalid therefore we must error
125         --
126         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
127         hr_utility.raise_error;
128       End If;
129       Close C_Sel1;
130       If (p_object_version_number <> g_old_rec.object_version_number) Then
131         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
132         hr_utility.raise_error;
133       End If;
134       hr_utility.set_location(l_proc, 15);
135       l_fct_ret := true;
136     End If;
137   End If;
138   hr_utility.set_location(' Leaving:'||l_proc, 20);
139   Return (l_fct_ret);
140 --
141 End api_updating;
142 --
143 -- ----------------------------------------------------------------------------
144 -- |---------------------------------< lck >----------------------------------|
145 -- ----------------------------------------------------------------------------
146 Procedure lck
147   (
148   p_analyzed_data_id                   in number,
149   p_object_version_number              in number
150   ) is
151 --
152 -- Cursor selects the 'current' row from the HR Schema
153 --
154   Cursor C_Sel1 is
155     select 	analyzed_data_id,
156 	assignment_id,
157 	data_source,
158 	tax_year,
159 	current_residency_status,
160 	nra_to_ra_date,
161 	target_departure_date,
162 	tax_residence_country_code,
163 	treaty_info_update_date,
164 	number_of_days_in_usa,
165 	withldg_allow_eligible_flag,
166 	ra_effective_date,
167 	record_source,
168 	visa_type,
169 	j_sub_type,
170 	primary_activity,
171 	non_us_country_code,
172 	citizenship_country_code,
173 	object_version_number	,
174         date_8233_signed,
175         date_w4_signed
176     from	pqp_analyzed_alien_data
177     where	analyzed_data_id = p_analyzed_data_id
178     for	update nowait;
179 --
180   l_proc	varchar2(72) := g_package||'lck';
181 --
182 Begin
183   hr_utility.set_location('Entering:'||l_proc, 5);
184   --
185   -- Add any mandatory argument checking here:
186   -- Example:
187   -- hr_api.mandatory_arg_error
188   --   (p_api_name       => l_proc,
189   --    p_argument       => 'object_version_number',
190   --    p_argument_value => p_object_version_number);
191   --
192   Open  C_Sel1;
193   Fetch C_Sel1 Into g_old_rec;
194   If C_Sel1%notfound then
195     Close C_Sel1;
196     --
197     -- The primary key is invalid therefore we must error
198     --
199     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
200     hr_utility.raise_error;
201   End If;
202   Close C_Sel1;
203   If (p_object_version_number <> g_old_rec.object_version_number) Then
204         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
205         hr_utility.raise_error;
206       End If;
207 --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 --
210 -- We need to trap the ORA LOCK exception
211 --
212 Exception
213   When HR_Api.Object_Locked then
214     --
215     -- The object is locked therefore we need to supply a meaningful
216     -- error message.
217     --
218     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
219     hr_utility.set_message_token('TABLE_NAME', 'pqp_analyzed_alien_data');
220     hr_utility.raise_error;
221 End lck;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |-----------------------------< convert_args >-----------------------------|
225 -- ----------------------------------------------------------------------------
226 Function convert_args
227 	(
228 	p_analyzed_data_id              in number,
229 	p_assignment_id                 in number,
230 	p_data_source                   in varchar2,
231 	p_tax_year                      in number,
232 	p_current_residency_status      in varchar2,
233 	p_nra_to_ra_date                in date,
234 	p_target_departure_date         in date,
235 	p_tax_residence_country_code    in varchar2,
236 	p_treaty_info_update_date       in date,
237 	p_number_of_days_in_usa         in number,
238 	p_withldg_allow_eligible_flag   in varchar2,
239 	p_ra_effective_date             in date,
240 	p_record_source                 in varchar2,
241 	p_visa_type                     in varchar2,
242 	p_j_sub_type                    in varchar2,
243 	p_primary_activity              in varchar2,
244 	p_non_us_country_code           in varchar2,
245 	p_citizenship_country_code      in varchar2,
246 	p_object_version_number         in number ,
247         p_date_8233_signed              in date   ,
248         p_date_w4_signed                in date
249 	)
250 	Return g_rec_type is
251 --
252   l_rec	  g_rec_type;
253   l_proc  varchar2(72) := g_package||'convert_args';
254 --
255 Begin
256   --
257   hr_utility.set_location('Entering:'||l_proc, 5);
258   --
259   -- Convert arguments into local l_rec structure.
260   --
261   l_rec.analyzed_data_id                 := p_analyzed_data_id;
262   l_rec.assignment_id                    := p_assignment_id;
263   l_rec.data_source                      := p_data_source;
264   l_rec.tax_year                         := p_tax_year;
265   l_rec.current_residency_status         := p_current_residency_status;
266   l_rec.nra_to_ra_date                   := p_nra_to_ra_date;
267   l_rec.target_departure_date            := p_target_departure_date;
268   l_rec.tax_residence_country_code       := p_tax_residence_country_code;
269   l_rec.treaty_info_update_date          := p_treaty_info_update_date;
270   l_rec.number_of_days_in_usa            := p_number_of_days_in_usa;
271   l_rec.withldg_allow_eligible_flag      := p_withldg_allow_eligible_flag;
272   l_rec.ra_effective_date                := p_ra_effective_date;
273   l_rec.record_source                    := p_record_source;
274   l_rec.visa_type                        := p_visa_type;
275   l_rec.j_sub_type                       := p_j_sub_type;
276   l_rec.primary_activity                 := p_primary_activity;
277   l_rec.non_us_country_code              := p_non_us_country_code;
278   l_rec.citizenship_country_code         := p_citizenship_country_code;
279   l_rec.object_version_number            := p_object_version_number;
280   l_rec.date_8233_signed                 := p_date_8233_signed     ;
281   l_rec.date_w4_signed                   := p_date_w4_signed       ;
282   --
283   -- Return the plsql record structure.
284   --
285   hr_utility.set_location(' Leaving:'||l_proc, 10);
286   Return(l_rec);
287 --
288 End convert_args;
289 --
290 end pqp_aad_shd;