DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PSO_SHD

Source


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