DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IVC_SHD

Source


1 Package Body irc_ivc_shd as
2 /* $Header: irivcrhi.pkb 120.0 2005/07/26 15:12:26 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_ivc_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_VACANCY_CONSIDERATIONS_FK') 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 = 'IRC_VACANCY_CONSIDERATIONS_PK') 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   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
37   --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_vacancy_consideration_id             in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48   --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        vacancy_consideration_id
55       ,person_id
56       ,party_id
57       ,vacancy_id
58       ,consideration_status
59       ,object_version_number
60     from        irc_vacancy_considerations
61     where        vacancy_consideration_id = p_vacancy_consideration_id;
62   --
63   l_fct_ret     boolean;
64   --
65 Begin
66   --
67   If (p_object_version_number is null
68      ) Then
69     --
70     -- One of the primary key arguments is null therefore we must
71     -- set the returning function value to false
72     --
73     l_fct_ret := false;
74   Else
75     If (p_vacancy_consideration_id
76         = irc_ivc_shd.g_old_rec.vacancy_consideration_id and
77         p_object_version_number
78         = irc_ivc_shd.g_old_rec.object_version_number
79        ) Then
80       --
81       -- The g_old_rec is current therefore we must
82       -- set the returning function to true
83       --
84       l_fct_ret := true;
85     Else
86       --
87       -- Select the current row into g_old_rec
88       --
89       Open C_Sel1;
90       Fetch C_Sel1 Into irc_ivc_shd.g_old_rec;
91       If C_Sel1%notfound Then
92         Close C_Sel1;
93         --
94         -- The primary key is invalid therefore we must error
95         --
96         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
97         fnd_message.raise_error;
98       End If;
99       Close C_Sel1;
100       If (p_object_version_number
101           <> irc_ivc_shd.g_old_rec.object_version_number) Then
102         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
103         fnd_message.raise_error;
104       End If;
105       l_fct_ret := true;
106     End If;
107   End If;
108   Return (l_fct_ret);
109 --
110 End api_updating;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |---------------------------------< lck >----------------------------------|
114 -- ----------------------------------------------------------------------------
115 Procedure lck
116   (p_vacancy_consideration_id             in     number
117   ,p_object_version_number                in     number
118   ) is
119 --
120 -- Cursor selects the 'current' row from the HR Schema
121 --
122   Cursor C_Sel1 is
123     select vacancy_consideration_id
124       ,person_id
125       ,party_id
126       ,vacancy_id
127       ,consideration_status
128       ,object_version_number
129     from        irc_vacancy_considerations
130     where       vacancy_consideration_id = p_vacancy_consideration_id
131     for update nowait;
132 --
133   l_proc        varchar2(72) := g_package||'lck';
134 --
135 Begin
136   hr_utility.set_location('Entering:'||l_proc, 5);
137   --
138 
139   hr_api.mandatory_arg_error
140     (p_api_name           => l_proc
141     ,p_argument           => 'VACANCY_CONSIDERATION_ID'
142     ,p_argument_value     => p_vacancy_consideration_id
143     );
144   hr_utility.set_location(l_proc,7);
145   hr_api.mandatory_arg_error
146     (p_api_name           => l_proc
147     ,p_argument           => 'OBJECT_VERSION_NUMBER'
148     ,p_argument_value     => p_object_version_number
149     );
150   --
151   Open  C_Sel1;
152   Fetch C_Sel1 Into irc_ivc_shd.g_old_rec;
153   If C_Sel1%notfound then
154     Close C_Sel1;
155     --
156     -- The primary key is invalid therefore we must error
157     --
158     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
159     fnd_message.raise_error;
160   End If;
161   Close C_Sel1;
162   If (p_object_version_number
163       <> irc_ivc_shd.g_old_rec.object_version_number) Then
164         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
165         fnd_message.raise_error;
166   End If;
167   --
168   hr_utility.set_location(' Leaving:'||l_proc, 10);
169   --
170   -- We need to trap the ORA LOCK exception
171   --
172 Exception
173   When HR_Api.Object_Locked then
174     --
175     -- The object is locked therefore we need to supply a meaningful
176     -- error message.
177     --
178     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
179     fnd_message.set_token('TABLE_NAME', 'irc_vacancy_considerations');
180     fnd_message.raise_error;
181 End lck;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |-----------------------------< convert_args >-----------------------------|
185 -- ----------------------------------------------------------------------------
186 Function convert_args
187   (p_vacancy_consideration_id       in number
188   ,p_person_id                      in number
189   ,p_party_id                       in number
190   ,p_vacancy_id                     in number
191   ,p_consideration_status           in varchar2
192   ,p_object_version_number          in number
193   )
194   Return g_rec_type is
195 --
196   l_rec   g_rec_type;
197 --
198 Begin
199   --
200   -- Convert arguments into local l_rec structure.
201   --
202   l_rec.vacancy_consideration_id         := p_vacancy_consideration_id;
203   l_rec.person_id                        := p_person_id;
204   l_rec.party_id                         := p_party_id;
205   l_rec.vacancy_id                       := p_vacancy_id;
206   l_rec.consideration_status             := p_consideration_status;
207   l_rec.object_version_number            := p_object_version_number;
208   --
209   -- Return the plsql record structure.
210   --
211   Return(l_rec);
212 --
213 End convert_args;
214 --
215 end irc_ivc_shd;