[Home] [Help]
PACKAGE BODY: APPS.HR_AMD_SHD
Source
1 Package Body hr_amd_shd as
2 /* $Header: hramdrhi.pkb 115.6 2002/12/03 16:08:21 apholt ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_amd_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16 l_proc varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19 hr_utility.set_location('Entering:'||l_proc, 5);
20 --
21 If (p_constraint_name = 'HR_API_MODULES_CK1') Then
22 hr_utility.set_message(800, 'PER_52121_AMD_MOD_TYPE_INV');
23 hr_utility.raise_error;
24 ElsIf (p_constraint_name = 'HR_API_MODULES_CK2') Then
25 hr_utility.set_message(800, 'PER_52122_AMD_DATA_WBG_INV');
26 hr_utility.raise_error;
27 --
28 --
29 -- This constraint will never be called....handled in the
30 -- procedure chk_module_package
31 --
32 ElsIf (p_constraint_name = 'HR_API_MODULES_CK3') Then
33 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('STEP','15');
36 hr_utility.raise_error;
37 ElsIf (p_constraint_name = 'HR_API_MODULES_PK') Then
38 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
39 hr_utility.set_message_token('PROCEDURE', l_proc);
40 hr_utility.set_message_token('STEP','20');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'HR_API_MODULES_UK1') Then
43 hr_utility.set_message(800, 'PER_52119_AMD_MOD_NAME_NOT_UNQ');
44 hr_utility.set_message_token('PROCEDURE', l_proc);
45 hr_utility.set_message_token('STEP','25');
46 hr_utility.raise_error;
47 Else
48 hr_utility.set_message(800, 'HR_7877_API_INVALID_CONSTRAINT');
49 hr_utility.set_message_token('PROCEDURE', l_proc);
50 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
51 hr_utility.raise_error;
52 End If;
53 --
54 hr_utility.set_location(' Leaving:'||l_proc, 10);
55 End constraint_error;
56 --
57 -- ----------------------------------------------------------------------------
58 -- |-----------------------------< api_updating >-----------------------------|
59 -- ----------------------------------------------------------------------------
60 Function api_updating
61 (
62 p_api_module_id in number
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 api_module_id,
71 api_module_type,
72 module_name,
73 data_within_business_group,
74 legislation_code,
75 module_package
76 from hr_api_modules
77 where api_module_id = p_api_module_id;
78 --
79 l_proc varchar2(72) := g_package||'api_updating';
80 l_fct_ret boolean;
81 --
82 Begin
83 hr_utility.set_location('Entering:'||l_proc, 5);
84 --
85
86 If (
87 p_api_module_id is null
88 ) Then
89 --
90 -- One of the primary key arguments is null therefore we must
91 -- set the returning function value to false
92 --
93
94 l_fct_ret := false;
95 Else
96 If (
97 p_api_module_id = g_old_rec.api_module_id
98 ) Then
99 hr_utility.set_location(l_proc, 10);
100 --
101 -- The g_old_rec is current therefore we must
102 -- set the returning function to true
103 --
104 l_fct_ret := true;
105 Else
106 --
107 -- Select the current row into g_old_rec
108 --
109 Open C_Sel1;
110 Fetch C_Sel1 Into g_old_rec;
111 If C_Sel1%notfound Then
112 Close C_Sel1;
113 --
114 -- The primary key is invalid therefore we must error
115 --
116 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
117 hr_utility.raise_error;
118 End If;
119 Close C_Sel1;
120 --
121 hr_utility.set_location(l_proc, 15);
122 l_fct_ret := true;
123 End If;
124 End If;
125 hr_utility.set_location(' Leaving:'||l_proc, 20);
126 Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134 (
135 p_api_module_id in number
136 ) is
137 --
138 -- Cursor selects the 'current' row from the HR Schema
139 --
140 Cursor C_Sel1 is
141 select api_module_id,
142 api_module_type,
143 module_name,
144 data_within_business_group,
145 legislation_code,
146 module_package
147 from hr_api_modules
148 where api_module_id = p_api_module_id
149 for update nowait;
150 --
151 l_proc varchar2(72) := g_package||'lck';
152 --
153 Begin
154 hr_utility.set_location('Entering:'||l_proc, 5);
155 --
156 -- Add any mandatory argument checking here:
157 -- Example:
158 -- hr_api.mandatory_arg_error
159 -- (p_api_name => l_proc,
160 -- p_argument => 'object_version_number',
161 -- p_argument_value => p_object_version_number);
162 --
163
164 -- There are no mandatory parms for update so no checking
165 -- is performed here.
166
167 Open C_Sel1;
168 Fetch C_Sel1 Into g_old_rec;
169 If C_Sel1%notfound then
170 Close C_Sel1;
171 --
172 -- The primary key is invalid therefore we must error
173 --
174 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
175 hr_utility.raise_error;
176 End If;
177 Close C_Sel1;
178 --
179 --
180 hr_utility.set_location(' Leaving:'||l_proc, 10);
181 --
182 -- We need to trap the ORA LOCK exception
183 --
184 Exception
185 When HR_Api.Object_Locked then
186 --
187 -- The object is locked therefore we need to supply a meaningful
188 -- error message.
189 --
190 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
191 hr_utility.set_message_token('TABLE_NAME', 'hr_api_modules');
192 hr_utility.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199 (
200 p_api_module_id in number,
201 p_api_module_type in varchar2,
202 p_module_name in varchar2,
203 p_data_within_business_group in varchar2,
204 p_legislation_code in varchar2,
205 p_module_package in varchar2
206 )
207 Return g_rec_type is
208 --
209 l_rec g_rec_type;
210 l_proc varchar2(72) := g_package||'convert_args';
211 --
212 Begin
213 --
214 hr_utility.set_location('Entering:'||l_proc, 5);
215 --
216 -- Convert arguments into local l_rec structure.
217 --
218 l_rec.api_module_id := p_api_module_id;
219 l_rec.api_module_type := p_api_module_type;
220 l_rec.module_name := p_module_name;
221 l_rec.data_within_business_group := p_data_within_business_group;
222 l_rec.legislation_code := p_legislation_code;
223 l_rec.module_package := p_module_package;
224 --
225 -- Return the plsql record structure.
226 --
227 hr_utility.set_location(' Leaving:'||l_proc, 10);
228 Return(l_rec);
229 --
230 End convert_args;
231 --
232 end hr_amd_shd;