DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IAS_SHD

Source


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