[Home] [Help]
PACKAGE BODY: APPS.HR_CAL_SHD
Source
1 Package Body hr_cal_shd as
2 /* $Header: hrcalrhi.pkb 115.3 99/10/07 08:14:01 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_cal_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'HR_CAL_START_POSITION_POSITIVE') Then
37 hr_utility.set_message(801, 'HR_51061_CAL_START_POSITIVE');
38 --
39 elsif (p_constraint_name = 'HR_PAT_NAME_UK') Then
40 -- *** TEMP ***
41 -- The names of the messages for constraints HR_PAT_NAME_UK and HR_CAL_PK
42 -- have been incorrectly entered. Once the text from each has been swapped
43 -- then we must switch the message_name calls here.
44 -- ***TEMP ends ***
45 hr_utility.set_message(801, 'HR_51064_CAL_PK');
46 --
47 elsif (p_constraint_name = 'HR_CAL_PK') Then
48 hr_utility.set_message(801, 'HR_51065_CAL_PAT_NAME_UK');
49 --
50 elsif (p_constraint_name = 'HR_CAL_PAT_FK') Then
51 hr_utility.set_message(801, 'HR_51066_CAL_PAT_FK');
52 --
53 Else
54 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
55 hr_utility.set_message_token('PROCEDURE', l_proc);
56 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
57 End If;
58 --
59 hr_utility.raise_error;
60 --
61 hr_utility.set_location(' Leaving:'||l_proc, 10);
62 --
63 End constraint_error;
64 --
65 -- ----------------------------------------------------------------------------
66 -- |-----------------------------< api_updating >-----------------------------|
67 -- ----------------------------------------------------------------------------
68 Function api_updating
69 (
70 p_calendar_id in number,
71 p_object_version_number in number
72 ) Return Boolean Is
73 --
74 --
75 -- Cursor selects the 'current' row from the HR Schema
76 --
77 Cursor C_Sel1 is
78 select
79 calendar_id,
80 calendar_name,
81 pattern_start_position,
82 calendar_start_time,
83 pattern_id,
84 object_version_number
85 from hr_calendars
86 where calendar_id = p_calendar_id;
87 --
88 l_proc varchar2(72) := g_package||'api_updating';
89 l_fct_ret boolean;
90 --
91 Begin
92 hr_utility.set_location('Entering:'||l_proc, 5);
93 --
94 If (
95 p_calendar_id is null and
96 p_object_version_number is null
97 ) Then
98 --
99 -- One of the primary key arguments is null therefore we must
100 -- set the returning function value to false
101 --
102 l_fct_ret := false;
103 Else
104 If (
105 p_calendar_id = g_old_rec.calendar_id and
106 p_object_version_number = g_old_rec.object_version_number
107 ) Then
108 hr_utility.set_location(l_proc, 10);
109 --
110 -- The g_old_rec is current therefore we must
111 -- set the returning function to true
112 --
113 l_fct_ret := true;
114 Else
115 --
116 -- Select the current row into g_old_rec
117 --
118 Open C_Sel1;
119 Fetch C_Sel1 Into g_old_rec;
120 If C_Sel1%notfound Then
121 Close C_Sel1;
122 --
123 -- The primary key is invalid therefore we must error
124 --
125 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
126 hr_utility.raise_error;
127 End If;
128 Close C_Sel1;
129 If (p_object_version_number <> g_old_rec.object_version_number) Then
130 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
131 hr_utility.raise_error;
132 End If;
133 hr_utility.set_location(l_proc, 15);
134 l_fct_ret := true;
135 End If;
136 End If;
137 hr_utility.set_location(' Leaving:'||l_proc, 20);
138 Return (l_fct_ret);
139 --
140 End api_updating;
141 --
142 -- ----------------------------------------------------------------------------
143 -- |---------------------------------< lck >----------------------------------|
144 -- ----------------------------------------------------------------------------
145 Procedure lck
146 (
147 p_calendar_id in number,
148 p_object_version_number in number
149 ) is
150 --
151 -- Cursor selects the 'current' row from the HR Schema
152 --
153 Cursor C_Sel1 is
154 select calendar_id,
155 calendar_name,
156 pattern_start_position,
157 calendar_start_time,
158 pattern_id,
159 object_version_number
160 from hr_calendars
161 where calendar_id = p_calendar_id
162 for update nowait;
163 --
164 l_proc varchar2(72) := g_package||'lck';
165 --
166 Begin
167 hr_utility.set_location('Entering:'||l_proc, 5);
168 --
169 -- Add any mandatory argument checking here:
170 -- Example:
171 -- hr_api.mandatory_arg_error
172 -- (p_api_name => l_proc,
173 -- p_argument => 'object_version_number',
174 -- p_argument_value => p_object_version_number);
175 --
176 Open C_Sel1;
177 Fetch C_Sel1 Into g_old_rec;
178 If C_Sel1%notfound then
179 Close C_Sel1;
180 --
181 -- The primary key is invalid therefore we must error
182 --
183 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
184 hr_utility.raise_error;
185 End If;
186 Close C_Sel1;
187 If (p_object_version_number <> g_old_rec.object_version_number) Then
188 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
189 hr_utility.raise_error;
190 End If;
191 --
192 hr_utility.set_location(' Leaving:'||l_proc, 10);
193 --
194 -- We need to trap the ORA LOCK exception
195 --
196 Exception
197 When HR_Api.Object_Locked then
198 --
199 -- The object is locked therefore we need to supply a meaningful
200 -- error message.
201 --
202 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
203 hr_utility.set_message_token('TABLE_NAME', 'hr_calendars');
204 hr_utility.raise_error;
205 End lck;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |-----------------------------< convert_args >-----------------------------|
209 -- ----------------------------------------------------------------------------
210 Function convert_args
211 (
212 p_calendar_id in number,
213 p_calendar_name in varchar2,
214 p_pattern_start_position in number,
215 p_calendar_start_time in date,
216 p_pattern_id in number,
217 p_object_version_number in number
218 )
219 Return g_rec_type is
220 --
221 l_rec g_rec_type;
222 l_proc varchar2(72) := g_package||'convert_args';
223 --
224 Begin
225 --
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 -- Convert arguments into local l_rec structure.
229 --
230 l_rec.calendar_id := p_calendar_id;
231 l_rec.calendar_name := p_calendar_name;
232 l_rec.pattern_start_position := p_pattern_start_position;
233 l_rec.calendar_start_time := p_calendar_start_time;
234 l_rec.pattern_id := p_pattern_id;
235 l_rec.object_version_number := p_object_version_number;
236 --
237 -- Return the plsql record structure.
238 --
239 hr_utility.set_location(' Leaving:'||l_proc, 10);
240 Return(l_rec);
241 --
242 End convert_args;
243 --
244 end hr_cal_shd;