DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SLS_SHD

Source


1 Package Body per_sls_shd as
2 /* $Header: peslsrhi.pkb 115.2 2003/08/07 23:58:22 vkonda noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_sls_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 = 'PER_SOLUITON_SETS_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_solution_set_name                    in     varchar2
40   ,p_user_id                              in     number
41   ,p_object_version_number                in     number
42   )
43   Return Boolean Is
44   --
45   --
46   -- Cursor selects the 'current' row from the HR Schema
47   --
48   Cursor C_Sel1 is
49     select
50        solution_set_name
51       ,user_id
52       ,description
53       ,status
54       ,solution_set_impl_id
55       ,object_version_number
56     from        per_solution_sets
57     where       solution_set_name = p_solution_set_name
58     and   user_id = p_user_id;
59   --
60   l_fct_ret     boolean;
61   --
62 Begin
63   --
64   If (p_solution_set_name is null and
65       p_user_id is null and
66       p_object_version_number is null
67      ) Then
68     --
69     -- One of the primary key arguments is null therefore we must
70     -- set the returning function value to false
71     --
72     l_fct_ret := false;
73   Else
74     If (p_solution_set_name
75         = per_sls_shd.g_old_rec.solution_set_name and
76         p_user_id
77         = per_sls_shd.g_old_rec.user_id and
78         p_object_version_number
79         = per_sls_shd.g_old_rec.object_version_number
80        ) Then
81       --
82       -- The g_old_rec is current therefore we must
83       -- set the returning function to true
84       --
85       l_fct_ret := true;
86     Else
87       --
88       -- Select the current row into g_old_rec
89       --
90       Open C_Sel1;
91       Fetch C_Sel1 Into per_sls_shd.g_old_rec;
92       If C_Sel1%notfound Then
93         Close C_Sel1;
94         --
95         -- The primary key is invalid therefore we must error
96         --
97         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
98         fnd_message.raise_error;
99       End If;
100       Close C_Sel1;
101       If (p_object_version_number
102           <> per_sls_shd.g_old_rec.object_version_number) Then
103         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
104         fnd_message.raise_error;
105       End If;
106       l_fct_ret := true;
107     End If;
108   End If;
109   Return (l_fct_ret);
110 --
111 End api_updating;
112 --
113 -- ----------------------------------------------------------------------------
114 -- |---------------------------------< lck >----------------------------------|
115 -- ----------------------------------------------------------------------------
116 Procedure lck
117   (p_solution_set_name                    in     varchar2
118   ,p_user_id                              in     number
119   ,p_object_version_number                in     number
120   ) is
121 --
122 -- Cursor selects the 'current' row from the HR Schema
123 --
124   Cursor C_Sel1 is
125     select
126        solution_set_name
127       ,user_id
128       ,description
129       ,status
130       ,solution_set_impl_id
131       ,object_version_number
132     from        per_solution_sets
133     where       solution_set_name = p_solution_set_name
134     and   user_id = p_user_id
135     for update nowait;
136 --
137   l_proc        varchar2(72) := g_package||'lck';
138 --
139 Begin
140   hr_utility.set_location('Entering:'||l_proc, 5);
141   --
142   hr_api.mandatory_arg_error
143     (p_api_name           => l_proc
144     ,p_argument           => 'SOLUTION_SET_NAME'
145     ,p_argument_value     => p_solution_set_name
146     );
147   hr_utility.set_location(l_proc,6);
148   hr_api.mandatory_arg_error
149     (p_api_name           => l_proc
150     ,p_argument           => 'USER_ID'
151     ,p_argument_value     => p_user_id
152     );
153   hr_utility.set_location(l_proc,7);
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   --
160   Open  C_Sel1;
161   Fetch C_Sel1 Into per_sls_shd.g_old_rec;
162   If C_Sel1%notfound then
163     Close C_Sel1;
164     --
165     -- The primary key is invalid therefore we must error
166     --
167     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
168     fnd_message.raise_error;
169   End If;
170   Close C_Sel1;
171   If (p_object_version_number
172       <> per_sls_shd.g_old_rec.object_version_number) Then
173         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
174         fnd_message.raise_error;
175   End If;
176   --
177   hr_utility.set_location(' Leaving:'||l_proc, 10);
178   --
179   -- We need to trap the ORA LOCK exception
180   --
181 Exception
182   When HR_Api.Object_Locked then
183     --
184     -- The object is locked therefore we need to supply a meaningful
185     -- error message.
186     --
187     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
188     fnd_message.set_token('TABLE_NAME', 'per_solution_sets');
189     fnd_message.raise_error;
190 End lck;
191 --
192 -- ----------------------------------------------------------------------------
193 -- |-----------------------------< convert_args >-----------------------------|
194 -- ----------------------------------------------------------------------------
195 Function convert_args
196   (p_solution_set_name              in varchar2
197   ,p_user_id                        in number
198   ,p_description                    in varchar2
199   ,p_status                         in varchar2
200   ,p_solution_set_impl_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.solution_set_name                := p_solution_set_name;
212   l_rec.user_id                          := p_user_id;
213   l_rec.description                      := p_description;
214   l_rec.status                           := p_status;
215   l_rec.solution_set_impl_id             := p_solution_set_impl_id;
216   l_rec.object_version_number            := p_object_version_number;
217   --
218   -- Return the plsql record structure.
219   --
220   Return(l_rec);
221 --
222 End convert_args;
223 --
224 end per_sls_shd;