DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_JBI_SHD

Source


1 Package Body irc_jbi_shd as
2 /* $Header: irjbirhi.pkb 120.0 2005/07/26 15:13:16 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_jbi_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 = 'IRC_JOB_BASKET_ITEMS_FK1') 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   ElsIf (p_constraint_name = 'IRC_JOB_BASKET_ITEMS_PK') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   Else
43     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
46     fnd_message.raise_error;
47   End If;
48   --
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (p_job_basket_item_id            in     number
56   ,p_object_version_number         in     number
57   )
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        job_basket_item_id
66       ,person_id
67       ,party_id
68       ,recruitment_activity_id
69       ,object_version_number
70     from        irc_job_basket_items
71     where       job_basket_item_id = p_job_basket_item_id;
72   --
73   l_fct_ret     boolean;
74   --
75 Begin
76   --
77   If (p_job_basket_item_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_job_basket_item_id
87         = irc_jbi_shd.g_old_rec.job_basket_item_id and
88         p_object_version_number
89         = irc_jbi_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 irc_jbi_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           <> irc_jbi_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_job_basket_item_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 job_basket_item_id
135       ,person_id
136       ,party_id
137       ,recruitment_activity_id
138       ,object_version_number
139     from        irc_job_basket_items
140     where       job_basket_item_id = p_job_basket_item_id
141     for update nowait;
142 --
143   l_proc        varchar2(72) := g_package||'lck';
144 --
145 Begin
146   hr_utility.set_location('Entering:'||l_proc, 5);
147   --
148   hr_api.mandatory_arg_error
149     (p_api_name           => l_proc
150     ,p_argument           => 'JOB_BASKET_ITEM_ID'
151     ,p_argument_value     => p_job_basket_item_id
152     );
153   hr_utility.set_location(l_proc,6);
154   hr_api.mandatory_arg_error
155     (p_api_name           => l_proc
156     ,p_argument           => 'OBJECT_VERSION_NUMBER'
157     ,p_argument_value     => p_object_version_number
158     );
159   hr_utility.set_location(l_proc,7);
160   --
161   Open  C_Sel1;
162   Fetch C_Sel1 Into irc_jbi_shd.g_old_rec;
163   If C_Sel1%notfound then
164     Close C_Sel1;
165     --
166     -- The primary key is invalid therefore we must error
167     --
168     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
169     fnd_message.raise_error;
170   End If;
171   Close C_Sel1;
172   If (p_object_version_number
173       <> irc_jbi_shd.g_old_rec.object_version_number) Then
174         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
175         fnd_message.raise_error;
176   End If;
177   --
178   hr_utility.set_location(' Leaving:'||l_proc, 10);
179   --
180   -- We need to trap the ORA LOCK exception
181   --
182 Exception
183   When HR_Api.Object_Locked then
184     --
185     -- The object is locked therefore we need to supply a meaningful
186     -- error message.
187     --
188     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
189     fnd_message.set_token('TABLE_NAME', 'irc_job_basket_items');
190     fnd_message.raise_error;
191 End lck;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< convert_args >-----------------------------|
195 -- ----------------------------------------------------------------------------
196 Function convert_args
197   (p_job_basket_item_id             in number
198   ,p_party_id                       in number
199   ,p_person_id                      in number
200   ,p_recruitment_activity_id        in number
201   ,p_object_version_number          in number
202   )
203   Return g_rec_type is
204 --
205   l_rec   g_rec_type;
206 --
207 Begin
208   --
209   -- Convert arguments into local l_rec structure.
210   --
211   l_rec.job_basket_item_id               := p_job_basket_item_id;
212   l_rec.party_id                         := p_party_id;
213   l_rec.person_id                        := p_person_id;
214   l_rec.recruitment_activity_id          := p_recruitment_activity_id;
215   l_rec.object_version_number            := p_object_version_number;
216   --
217   -- Return the plsql record structure.
218   --
219   Return(l_rec);
220 --
221 End convert_args;
222 --
223 end irc_jbi_shd;