DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_AMM_SHD

Source


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