DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RCF_SHD

Source


1 Package Body per_rcf_shd as
2 /* $Header: percfrhi.pkb 120.2 2006/04/07 04:33:51 cnholmes noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_rcf_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PER_RECRUITMENT_ACTIVITY_F_FK1') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITY_F_FK2') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITY_F_FK3') Then
32     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITY_F_PK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','20');
40     fnd_message.raise_error;
41   Else
42     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45     fnd_message.raise_error;
46   End If;
47   --
48 End constraint_error;
49 --
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------------< api_updating >-----------------------------|
52 -- ----------------------------------------------------------------------------
53 Function api_updating
54   (p_rec_activity_for_id          in     number
55   ,p_object_version_number        in     number
56   )
57   Return Boolean Is
58   --
59   --
60   -- Cursor selects the 'current' row from the HR Schema
61   --
62   Cursor C_Sel1 is
63     select
64        recruitment_activity_for_id
65       ,business_group_id
66       ,vacancy_id
67       ,recruitment_activity_id
68       ,request_id
69       ,program_application_id
70       ,program_id
71       ,program_update_date
72       ,object_version_number
73     from        per_recruitment_activity_for
74     where       recruitment_activity_for_id = p_rec_activity_for_id;
75   --
76   l_fct_ret     boolean;
77   --
78 Begin
79   --
80   If (p_rec_activity_for_id is null and
81       p_object_version_number is null
82      ) Then
83     --
84     -- One of the primary key arguments is null therefore we must
85     -- set the returning function value to false
86     --
87     l_fct_ret := false;
88   Else
89     If (p_rec_activity_for_id
90         = per_rcf_shd.g_old_rec.rec_activity_for_id and
91         p_object_version_number
92         = per_rcf_shd.g_old_rec.object_version_number
93        ) Then
94       --
95       -- The g_old_rec is current therefore we must
96       -- set the returning function to true
97       --
98       l_fct_ret := true;
99     Else
100       --
101       -- Select the current row into g_old_rec
102       --
103       Open C_Sel1;
104       Fetch C_Sel1 Into per_rcf_shd.g_old_rec;
105       If C_Sel1%notfound Then
106         Close C_Sel1;
107         --
108         -- The primary key is invalid therefore we must error
109         --
110         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
111         fnd_message.raise_error;
112       End If;
113       Close C_Sel1;
114       If (p_object_version_number
115           <> per_rcf_shd.g_old_rec.object_version_number) Then
116         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
117         fnd_message.raise_error;
118       End If;
119       l_fct_ret := true;
120     End If;
121   End If;
122   Return (l_fct_ret);
123 --
124 End api_updating;
125 --
126 -- ----------------------------------------------------------------------------
127 -- |---------------------------------< lck >----------------------------------|
128 -- ----------------------------------------------------------------------------
129 Procedure lck
130   (p_rec_activity_for_id          in     number
131   ,p_object_version_number                in     number
132   ) is
133 --
134 -- Cursor selects the 'current' row from the HR Schema
135 --
136   Cursor C_Sel1 is
137     select
138        recruitment_activity_for_id
139       ,business_group_id
140       ,vacancy_id
141       ,recruitment_activity_id
142       ,request_id
143       ,program_application_id
144       ,program_id
145       ,program_update_date
146       ,object_version_number
147     from        per_recruitment_activity_for
148     where       recruitment_activity_for_id = p_rec_activity_for_id
149     for update nowait;
150 --
151   l_proc        varchar2(72) := g_package||'lck';
152 --
153 Begin
154   hr_utility.set_location('Entering:'||l_proc, 5);
155   --
156   hr_api.mandatory_arg_error
157     (p_api_name           => l_proc
158     ,p_argument           => 'RECRUITMENT_ACTIVITY_FOR_ID'
159     ,p_argument_value     => p_rec_activity_for_id
160     );
161   hr_utility.set_location(l_proc,6);
162   hr_api.mandatory_arg_error
163     (p_api_name           => l_proc
164     ,p_argument           => 'OBJECT_VERSION_NUMBER'
165     ,p_argument_value     => p_object_version_number
166     );
167   --
168   Open  C_Sel1;
169   Fetch C_Sel1 Into per_rcf_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       <> per_rcf_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   hr_utility.set_location(' Leaving:'||l_proc, 10);
186   --
187   -- We need to trap the ORA LOCK exception
188   --
189 Exception
190   When HR_Api.Object_Locked then
191     --
192     -- The object is locked therefore we need to supply a meaningful
193     -- error message.
194     --
195     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
196     fnd_message.set_token('TABLE_NAME', 'per_recruitment_activity_for');
197     fnd_message.raise_error;
198 End lck;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |-----------------------------< convert_args >-----------------------------|
202 -- ----------------------------------------------------------------------------
203 Function convert_args
204   (p_rec_activity_for_id    in number
205   ,p_business_group_id              in number
206   ,p_vacancy_id                     in number
207   ,p_rec_activity_id        in number
208   ,p_request_id                     in number
209   ,p_program_application_id         in number
210   ,p_program_id                     in number
211   ,p_program_update_date            in date
212   ,p_object_version_number          in number
213   )
214   Return g_rec_type is
215 --
216   l_rec   g_rec_type;
217 --
218 Begin
219   --
220   -- Convert arguments into local l_rec structure.
221   --
222   l_rec.rec_activity_for_id              := p_rec_activity_for_id;
223   l_rec.business_group_id                := p_business_group_id;
224   l_rec.vacancy_id                       := p_vacancy_id;
225   l_rec.rec_activity_id                  := p_rec_activity_id;
226   l_rec.request_id                       := p_request_id;
227   l_rec.program_application_id           := p_program_application_id;
228   l_rec.program_id                       := p_program_id;
229   l_rec.program_update_date              := p_program_update_date;
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 per_rcf_shd;