DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_APS_SHD

Source


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