DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ENT_SHD

Source


1 Package Body per_ent_shd as
2 /* $Header: peentrhi.pkb 120.2 2005/06/16 08:27:40 vegopala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ent_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 = 'SYS_C00223718') 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_calendar_entry_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        calendar_entry_id
50       ,business_group_id
51       ,name
52       ,type
53       ,start_date
54       ,start_hour
55       ,start_min
56       ,end_date
57       ,end_hour
58       ,end_min
59       ,description
60       ,hierarchy_id
61       ,value_set_id
62       ,organization_structure_id
63       ,org_structure_version_id
64       ,legislation_code
65       ,identifier_key
66       ,object_version_number
67     from        per_calendar_entries
68     where       calendar_entry_id = p_calendar_entry_id;
69   --
70   l_fct_ret     boolean;
71   --
72 Begin
73   --
74   If (p_calendar_entry_id is null and
75       p_object_version_number is null
76      ) Then
77     --
78     -- One of the primary key arguments is null therefore we must
79     -- set the returning function value to false
80     --
81     l_fct_ret := false;
82   Else
83     If (p_calendar_entry_id
84         = per_ent_shd.g_old_rec.calendar_entry_id and
85         p_object_version_number
86         = per_ent_shd.g_old_rec.object_version_number
87        ) Then
88       --
89       -- The g_old_rec is current therefore we must
90       -- set the returning function to true
91       --
92       l_fct_ret := true;
93     Else
94       --
95       -- Select the current row into g_old_rec
96       --
97       Open C_Sel1;
98       Fetch C_Sel1 Into per_ent_shd.g_old_rec;
99       If C_Sel1%notfound Then
100         Close C_Sel1;
101         --
102         -- The primary key is invalid therefore we must error
103         --
104         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
105         fnd_message.raise_error;
106       End If;
107       Close C_Sel1;
108       If (p_object_version_number
109           <> per_ent_shd.g_old_rec.object_version_number) Then
110         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
111         fnd_message.raise_error;
112       End If;
113       l_fct_ret := true;
114     End If;
115   End If;
116   Return (l_fct_ret);
117 --
118 End api_updating;
119 --
120 -- ----------------------------------------------------------------------------
121 -- |---------------------------------< lck >----------------------------------|
122 -- ----------------------------------------------------------------------------
123 Procedure lck
124   (p_calendar_entry_id                    in     number
125   ,p_object_version_number                in     number
126   ) is
127 --
128 -- Cursor selects the 'current' row from the HR Schema
129 --
130   Cursor C_Sel1 is
131     select
132        calendar_entry_id
133       ,business_group_id
134       ,name
135       ,type
136       ,start_date
137       ,start_hour
138       ,start_min
139       ,end_date
140       ,end_hour
141       ,end_min
142       ,description
143       ,hierarchy_id
144       ,value_set_id
145       ,organization_structure_id
146       ,org_structure_version_id
147       ,legislation_code
148       ,identifier_key
149       ,object_version_number
150     from        per_calendar_entries
151     where       calendar_entry_id = p_calendar_entry_id
152     for update nowait;
153 --
154   l_proc        varchar2(72) := g_package||'lck';
155 --
156 Begin
157   hr_utility.set_location('Entering:'||l_proc, 5);
158   --
159   hr_api.mandatory_arg_error
160     (p_api_name           => l_proc
161     ,p_argument           => 'CALENDAR_ENTRY_ID'
162     ,p_argument_value     => p_calendar_entry_id
163     );
164   hr_utility.set_location(l_proc,6);
165   hr_api.mandatory_arg_error
166     (p_api_name           => l_proc
167     ,p_argument           => 'OBJECT_VERSION_NUMBER'
168     ,p_argument_value     => p_object_version_number
169     );
170   --
171   Open  C_Sel1;
172   Fetch C_Sel1 Into per_ent_shd.g_old_rec;
173   If C_Sel1%notfound then
174     Close C_Sel1;
175     --
176     -- The primary key is invalid therefore we must error
177     --
178     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
179     fnd_message.raise_error;
180   End If;
181   Close C_Sel1;
182   If (p_object_version_number
183       <> per_ent_shd.g_old_rec.object_version_number) Then
184         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
185         fnd_message.raise_error;
186   End If;
187   --
188   hr_utility.set_location(' Leaving:'||l_proc, 10);
189   --
190   -- We need to trap the ORA LOCK exception
191   --
192 Exception
193   When HR_Api.Object_Locked then
194     --
195     -- The object is locked therefore we need to supply a meaningful
196     -- error message.
197     --
198     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
199     fnd_message.set_token('TABLE_NAME', 'per_calendar_entries');
200     fnd_message.raise_error;
201 End lck;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |-----------------------------< convert_args >-----------------------------|
205 -- ----------------------------------------------------------------------------
206 Function convert_args
207   (p_calendar_entry_id              in number
208   ,p_business_group_id              in number
209   ,p_name                           in varchar2
210   ,p_type                           in varchar2
211   ,p_start_date                     in date
212   ,p_start_hour                     in varchar2
213   ,p_start_min                      in varchar2
214   ,p_end_date                       in date
215   ,p_end_hour                       in varchar2
216   ,p_end_min                        in varchar2
217   ,p_description                    in varchar2
218   ,p_hierarchy_id                   in number
219   ,p_value_set_id                   in number
220   ,p_organization_structure_id      in number
221   ,p_org_structure_version_id       in number
222   ,p_legislation_code               in varchar2
223   ,p_identifier_key                 in varchar2
224   ,p_object_version_number          in number
225   )
226   Return g_rec_type is
227 --
228   l_rec   g_rec_type;
229 --
230 Begin
231   --
232   -- Convert arguments into local l_rec structure.
233   --
234   l_rec.calendar_entry_id                := p_calendar_entry_id;
235   l_rec.business_group_id                := p_business_group_id;
236   l_rec.name                             := p_name;
237   l_rec.type                             := p_type;
238   l_rec.start_date                       := p_start_date;
239   l_rec.start_hour                       := p_start_hour;
240   l_rec.start_min                        := p_start_min;
241   l_rec.end_date                         := p_end_date;
242   l_rec.end_hour                         := p_end_hour;
243   l_rec.end_min                          := p_end_min;
244   l_rec.description                      := p_description;
245   l_rec.hierarchy_id                     := p_hierarchy_id;
246   l_rec.value_set_id                     := p_value_set_id;
247   l_rec.organization_structure_id        := p_organization_structure_id;
248   l_rec.org_structure_version_id         := p_org_structure_version_id;
249   l_rec.legislation_code                 := p_legislation_code;
250   l_rec.identifier_key                   := p_identifier_key;
251   l_rec.object_version_number            := p_object_version_number;
252   --
253   -- Return the plsql record structure.
254   --
255   Return(l_rec);
256 --
257 End convert_args;
258 --
259 end per_ent_shd;