DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_RTM_SHD

Source


1 Package Body irc_rtm_shd as
2 /* $Header: irrtmrhi.pkb 120.3 2008/01/22 10:17:45 mkjayara noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_rtm_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 = 'IRC_REC_TEAM_MEMBERS_FK1') Then
22     hr_utility.set_message('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     hr_utility.set_message_token('PROCEDURE', l_proc);
24     hr_utility.set_message_token('STEP','5');
25     hr_utility.raise_error;
26   ElsIf (p_constraint_name = 'IRC_REC_TEAM_MEMBERS_FK2') Then
27     hr_utility.set_message('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     hr_utility.set_message_token('PROCEDURE', l_proc);
29     hr_utility.set_message_token('STEP','10');
30     hr_utility.raise_error;
31   ElsIf (p_constraint_name = 'IRC_REC_TEAM_MEMBERS_PK') Then
32     hr_utility.set_message('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     hr_utility.set_message_token('PROCEDURE', l_proc);
34     hr_utility.set_message_token('STEP','15');
35     hr_utility.raise_error;
36   Else
37     hr_utility.set_message('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
40     hr_utility.raise_error;
41   End If;
42   --
43 End constraint_error;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |-----------------------------< api_updating >-----------------------------|
47 -- ----------------------------------------------------------------------------
48 Function api_updating
49   (p_rec_team_member_id                   in     number
50   ,p_object_version_number                in     number
51   )
52   Return Boolean Is
53   --
54   --
55   -- Cursor selects the 'current' row from the HR Schema
56   --
57   Cursor C_Sel1 is
58     select
59        rec_team_member_id
60       ,person_id
61       ,party_id
62       ,vacancy_id
63       ,job_id
64       ,start_date
65       ,end_date
66       ,update_allowed
67       ,delete_allowed
68       ,object_version_number
69       ,interview_security
70     from        irc_rec_team_members
71     where       rec_team_member_id = p_rec_team_member_id;
72   --
73   l_fct_ret     boolean;
74   --
75 Begin
76   --
77   If (p_object_version_number is null
78      ) Then
79     --
80     -- One of the primary key arguments is null therefore we must
81     -- set the returning function value to false
82     --
83     l_fct_ret := false;
84   Else
85     If (p_rec_team_member_id
86         = irc_rtm_shd.g_old_rec.rec_team_member_id and
87         p_object_version_number
88         = irc_rtm_shd.g_old_rec.object_version_number
89        ) Then
90       --
91       -- The g_old_rec is current therefore we must
92       -- set the returning function to true
93       --
94       l_fct_ret := true;
95     Else
96       --
97       -- Select the current row into g_old_rec
98       --
99       Open C_Sel1;
100       Fetch C_Sel1 Into irc_rtm_shd.g_old_rec;
101       If C_Sel1%notfound Then
102         Close C_Sel1;
103         --
104         -- The primary key is invalid therefore we must error
105         --
106         fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
107         fnd_message.raise_error;
108       End If;
109       Close C_Sel1;
110       If (p_object_version_number
111           <> irc_rtm_shd.g_old_rec.object_version_number) Then
112         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
113         fnd_message.raise_error;
114       End If;
115       l_fct_ret := true;
116     End If;
117   End If;
118   Return (l_fct_ret);
119 --
120 End api_updating;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |---------------------------------< lck >----------------------------------|
124 -- ----------------------------------------------------------------------------
125 Procedure lck
126   (p_rec_team_member_id                   in     number
127   ,p_object_version_number                in     number
128   ) is
129 --
130 -- Cursor selects the 'current' row from the HR Schema
131 --
132   Cursor C_Sel1 is
133     select
134        rec_team_member_id
135       ,person_id
136       ,party_id
137       ,vacancy_id
138       ,job_id
139       ,start_date
140       ,end_date
141       ,update_allowed
142       ,delete_allowed
143       ,object_version_number
144       ,interview_security
145     from        irc_rec_team_members
146     where       rec_team_member_id = p_rec_team_member_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           => 'REC_TEAM_MEMBER_ID'
157     ,p_argument_value     => p_rec_team_member_id
158     );
159   hr_utility.set_location('Rec team member id ok at ' || l_proc,7);
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   hr_utility.set_location('OVN ok at ' || l_proc,9);
166   --
167   Open  C_Sel1;
168   Fetch C_Sel1 Into irc_rtm_shd.g_old_rec;
169   If C_Sel1%notfound then
170     Close C_Sel1;
171     --
172     -- The primary key is invalid therefore we must error
173     --
174     hr_utility.set_location('Invalid key at :'||l_proc, 11);
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       <> irc_rtm_shd.g_old_rec.object_version_number) Then
181         hr_utility.set_location('Invalid OVN at :'||l_proc, 14);
182         hr_utility.set_location(to_char(p_object_version_number) ||
183           'vs' || to_char(irc_rtm_shd.g_old_rec.object_version_number) ||
184           ' '||l_proc, 16);
185         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
186         fnd_message.raise_error;
187   End If;
188   --
189   hr_utility.set_location(' Leaving:'||l_proc, 20);
190   --
191   -- We need to trap the ORA LOCK exception
192   --
193 Exception
194   When HR_Api.Object_Locked then
195     --
196     -- The object is locked therefore we need to supply a meaningful
197     -- error message.
198     --
199     hr_utility.set_location('Object locked :'||l_proc, 21);
200     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
201     fnd_message.set_token('TABLE_NAME', 'irc_rec_team_members');
202     fnd_message.raise_error;
203 End lck;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |-----------------------------< convert_args >-----------------------------|
207 -- ----------------------------------------------------------------------------
208 Function convert_args
209   (p_rec_team_member_id             in number
210   ,p_person_id                      in number
211   ,p_party_id                       in number
212   ,p_vacancy_id                     in number
213   ,p_job_id                         in number
214   ,p_start_date                     in date
215   ,p_end_date                       in date
216   ,p_update_allowed                 in varchar2
217   ,p_delete_allowed                 in varchar2
218   ,p_object_version_number          in number
219   ,p_interview_security              in varchar2
220   )
221   Return g_rec_type is
222 --
223   l_rec   g_rec_type;
224 --
225 Begin
226   --
227   -- Convert arguments into local l_rec structure.
228   --
229   l_rec.rec_team_member_id               := p_rec_team_member_id;
230   l_rec.person_id                        := p_person_id;
231   l_rec.party_id                         := p_party_id;
232   l_rec.vacancy_id                       := p_vacancy_id;
233   l_rec.job_id                           := p_job_id;
234   l_rec.start_date                       := p_start_date;
235   l_rec.end_date                         := p_end_date;
236   l_rec.update_allowed                   := p_update_allowed;
237   l_rec.delete_allowed                   := p_delete_allowed;
238   l_rec.object_version_number            := p_object_version_number;
239   l_rec.interview_security               := p_interview_security;
240   --
241   -- Return the plsql record structure.
242   --
243   Return(l_rec);
244 --
245 End convert_args;
246 --
247 end irc_rtm_shd;