DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_ITA_SHD

Source


1 Package Body irc_ita_shd as
2 /* $Header: iritarhi.pkb 120.1 2005/10/04 06:26:25 kthavran noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_ita_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_TEMPLATE_ASSOCIATIONS_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 = 'IRC_TEMPLATE_ASSOCIATIONS_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 = 'IRC_TEMPLATE_ASSOCIATIONS_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 = 'IRC_TEMPLATE_ASSOCIATIONS_FK4') 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   ElsIf (p_constraint_name = 'IRC_TEMPLATE_ASSOCIATIONS_PK') Then
42     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('STEP','25');
45     fnd_message.raise_error;
46   Else
47     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
50     fnd_message.raise_error;
51   End If;
52   --
53 End constraint_error;
54 --
55 -- ----------------------------------------------------------------------------
56 -- |-----------------------------< api_updating >-----------------------------|
57 -- ----------------------------------------------------------------------------
58 Function api_updating
59   (p_template_association_id              in     number
60   ,p_object_version_number                in     number
61   )
62   Return Boolean Is
63   --
64   --
65   -- Cursor selects the 'current' row from the HR Schema
66   --
67   Cursor C_Sel1 is
68     select
69        template_association_id
70       ,template_id
71       ,default_association
72       ,job_id
73       ,position_id
74       ,organization_id
75       ,start_date
76       ,end_date
77       ,object_version_number
78     from        irc_template_associations
79     where       template_association_id = p_template_association_id;
80   --
81   l_fct_ret     boolean;
82   --
83 Begin
84   --
85   If (p_template_association_id is null and
86       p_object_version_number is null
87      ) Then
88     --
89     -- One of the primary key arguments is null therefore we must
90     -- set the returning function value to false
91     --
92     l_fct_ret := false;
93   Else
94     If (p_template_association_id
95         = irc_ita_shd.g_old_rec.template_association_id and
96         p_object_version_number
97         = irc_ita_shd.g_old_rec.object_version_number
98        ) Then
99       --
100       -- The g_old_rec is current therefore we must
101       -- set the returning function to true
102       --
103       l_fct_ret := true;
104     Else
105       --
106       -- Select the current row into g_old_rec
107       --
108       Open C_Sel1;
109       Fetch C_Sel1 Into irc_ita_shd.g_old_rec;
110       If C_Sel1%notfound Then
111         Close C_Sel1;
112         --
113         -- The primary key is invalid therefore we must error
114         --
115         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
116         fnd_message.raise_error;
117       End If;
118       Close C_Sel1;
119       If (p_object_version_number
120           <> irc_ita_shd.g_old_rec.object_version_number) Then
121         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
122         fnd_message.raise_error;
123       End If;
124       l_fct_ret := true;
125     End If;
126   End If;
127   Return (l_fct_ret);
128 --
129 End api_updating;
130 --
131 -- ----------------------------------------------------------------------------
132 -- |---------------------------------< lck >----------------------------------|
133 -- ----------------------------------------------------------------------------
134 Procedure lck
135   (p_template_association_id              in     number
136   ,p_object_version_number                in     number
137   ) is
138 --
139 -- Cursor selects the 'current' row from the HR Schema
140 --
141   Cursor C_Sel1 is
142     select
143        template_association_id
144       ,template_id
145       ,default_association
146       ,job_id
147       ,position_id
148       ,organization_id
149       ,start_date
150       ,end_date
151       ,object_version_number
152     from        irc_template_associations
153     where       template_association_id = p_template_association_id
154     for update nowait;
155 --
156   l_proc        varchar2(72) := g_package||'lck';
157 --
158 Begin
159   hr_utility.set_location('Entering:'||l_proc, 5);
160   --
161   hr_api.mandatory_arg_error
162     (p_api_name           => l_proc
163     ,p_argument           => 'TEMPLATE_ASSOCIATION_ID'
164     ,p_argument_value     => p_template_association_id
165     );
166   hr_utility.set_location(l_proc,6);
167   hr_api.mandatory_arg_error
168     (p_api_name           => l_proc
169     ,p_argument           => 'OBJECT_VERSION_NUMBER'
170     ,p_argument_value     => p_object_version_number
171     );
172   --
173   Open  C_Sel1;
174   Fetch C_Sel1 Into irc_ita_shd.g_old_rec;
175   If C_Sel1%notfound then
176     Close C_Sel1;
177     --
178     -- The primary key is invalid therefore we must error
179     --
180     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
181     fnd_message.raise_error;
182   End If;
183   Close C_Sel1;
184   If (p_object_version_number
185       <> irc_ita_shd.g_old_rec.object_version_number) Then
186         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
187         fnd_message.raise_error;
188   End If;
189   --
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191   --
192   -- We need to trap the ORA LOCK exception
193   --
194 Exception
195   When HR_Api.Object_Locked then
196     --
197     -- The object is locked therefore we need to supply a meaningful
198     -- error message.
199     --
200     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
201     fnd_message.set_token('TABLE_NAME', 'irc_template_associations');
202     fnd_message.raise_error;
203 End lck;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |-----------------------------< convert_args >-----------------------------|
207 -- ----------------------------------------------------------------------------
208 Function convert_args
209   (p_template_association_id        in number
210   ,p_template_id                    in number
211   ,p_default_association            in varchar2
212   ,p_job_id                         in number
213   ,p_position_id                    in number
214   ,p_organization_id                in number
215   ,p_start_date                     in date
216   ,p_end_date                       in date
217   ,p_object_version_number          in number
218   )
219   Return g_rec_type is
220 --
221   l_rec   g_rec_type;
222 --
223 Begin
224   --
225   -- Convert arguments into local l_rec structure.
226   --
227   l_rec.template_association_id          := p_template_association_id;
228   l_rec.template_id                      := p_template_id;
229   l_rec.default_association              := p_default_association;
230   l_rec.job_id                           := p_job_id;
231   l_rec.position_id                      := p_position_id;
232   l_rec.organization_id                  := p_organization_id;
233   l_rec.start_date                       := p_start_date;
234   l_rec.end_date                         := p_end_date;
235   l_rec.object_version_number            := p_object_version_number;
236   --
237   -- Return the plsql record structure.
238   --
239   Return(l_rec);
240 --
241 End convert_args;
242 --
243 end irc_ita_shd;