DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SOL_SHD

Source


1 Package Body per_sol_shd as
2 /* $Header: pesolrhi.pkb 120.3 2011/06/20 06:28:22 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_sol_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';
21   If (p_constraint_name = 'PER_SOLUTIONS_FK1') Then
18 --
19 Begin
20   --
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 = 'PER_SOLUTIONS_PK') 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   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
37   --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_solution_id                          in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48   --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        solution_name
55       ,solution_id
56       ,description
57       ,link_to_full_description
58       ,solution_type_name
59       ,vertical
60       ,legislation_code
61       ,user_id
62       ,object_version_number
63     from        per_solutions
64     where       solution_id = p_solution_id;
65   --
66   l_fct_ret     boolean;
67   --
68 Begin
69   --
70   If (p_solution_id is null and
71       p_object_version_number is null
72      ) Then
73     --
74     -- One of the primary key arguments is null therefore we must
75     -- set the returning function value to false
76     --
77     l_fct_ret := false;
78   Else
79     If (p_solution_id
80         = per_sol_shd.g_old_rec.solution_id and
81         p_object_version_number
82         = per_sol_shd.g_old_rec.object_version_number
83        ) Then
84       --
85       -- The g_old_rec is current therefore we must
86       -- set the returning function to true
87       --
88       l_fct_ret := true;
89     Else
90       --
91       -- Select the current row into g_old_rec
92       --
93       Open C_Sel1;
94       Fetch C_Sel1 Into per_sol_shd.g_old_rec;
95       If C_Sel1%notfound Then
96         Close C_Sel1;
97         --
98         -- The primary key is invalid therefore we must error
99         --
100         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
101         fnd_message.raise_error;
102       End If;
103       Close C_Sel1;
104       If (p_object_version_number
105           <> per_sol_shd.g_old_rec.object_version_number) Then
106         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
107         fnd_message.raise_error;
108       End If;
109       l_fct_ret := true;
110     End If;
111   End If;
112   Return (l_fct_ret);
113 --
114 End api_updating;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |---------------------------------< lck >----------------------------------|
118 -- ----------------------------------------------------------------------------
119 Procedure lck
120   (p_solution_id                          in     number
121   ,p_object_version_number                in     number
122   ) is
123 --
124 -- Cursor selects the 'current' row from the HR Schema
125 --
126   Cursor C_Sel1 is
127     select
128        solution_name
129       ,solution_id
130       ,description
131       ,link_to_full_description
132       ,solution_type_name
133       ,vertical
134       ,legislation_code
135       ,user_id
136       ,object_version_number
137     from        per_solutions
138     where       solution_id = p_solution_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           => 'SOLUTION_ID'
149     ,p_argument_value     => p_solution_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 per_sol_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       <> per_sol_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', 'per_solutions');
187     fnd_message.raise_error;
188 End lck;
189 --
190 -- ----------------------------------------------------------------------------
191 -- |-----------------------------< convert_args >-----------------------------|
192 -- ----------------------------------------------------------------------------
193 Function convert_args
194   (p_solution_name                  in varchar2
195   ,p_solution_id                    in number
196   ,p_description                    in varchar2
197   ,p_link_to_full_description       in varchar2
198   ,p_solution_type_name             in varchar2
199   ,p_vertical                       in varchar2
200   ,p_legislation_code               in varchar2
201   ,p_user_id                        in number
202   ,p_object_version_number          in number
203   )
204   Return g_rec_type is
205 --
206   l_rec   g_rec_type;
207 --
208 Begin
209   --
210   -- Convert arguments into local l_rec structure.
211   --
212   l_rec.solution_name                    := p_solution_name;
213   l_rec.solution_id                      := p_solution_id;
214   l_rec.description                      := p_description;
215   l_rec.link_to_full_description         := p_link_to_full_description;
216   l_rec.solution_type_name               := p_solution_type_name;
217   l_rec.vertical                         := p_vertical;
218   l_rec.legislation_code                 := p_legislation_code;
219   l_rec.user_id                          := p_user_id;
220   l_rec.object_version_number            := p_object_version_number;
221   --
222   -- Return the plsql record structure.
223   --
224   Return(l_rec);
225 --
226 End convert_args;
227 --
228 end per_sol_shd;