[Home] [Help]
PACKAGE BODY: APPS.HR_WPT_SHD
Source
1 Package Body hr_wpt_shd as
2 /* $Header: hrwptrhi.pkb 115.4 2002/12/03 14:23:01 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_wpt_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 = 'HR_WINDOW_PROPERTIES_TL_FK1') 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 ElsIf (p_constraint_name = 'HR_WINDOW_PROPERTIES_TL_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_window_property_id in number
45 ,p_language in varchar2
46 ) Return Boolean Is
47 --
48 --
49 -- Cursor selects the 'current' row from the HR Schema
50 --
51 Cursor C_Sel1 is
52 select
53 window_property_id
54 ,language
55 ,source_lang
56 ,title
57 from hr_window_properties_tl
58 where window_property_id = p_window_property_id
59 and language = p_language;
60 --
61 l_fct_ret boolean;
62 --
63 Begin
64 --
65 If (p_window_property_id is null or
66 p_language is null
67 ) Then
68 --
69 -- One of the primary key arguments is null therefore we must
70 -- set the returning function value to false
71 --
72 l_fct_ret := false;
73 Else
74 If (p_window_property_id
75 = hr_wpt_shd.g_old_rec.window_property_id and
76 p_language
77 = hr_wpt_shd.g_old_rec.language
78 ) Then
79 --
80 -- The g_old_rec is current therefore we must
81 -- set the returning function to true
82 --
83 l_fct_ret := true;
84 Else
85 --
86 -- Select the current row into g_old_rec
87 --
88 Open C_Sel1;
89 Fetch C_Sel1 Into hr_wpt_shd.g_old_rec;
90 If C_Sel1%notfound Then
91 Close C_Sel1;
92 --
93 -- The primary key is invalid therefore we must error
94 --
95 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
96 fnd_message.raise_error;
97 End If;
98 Close C_Sel1;
99 --
100 l_fct_ret := true;
101 End If;
102 End If;
103 Return (l_fct_ret);
104 --
105 End api_updating;
106 --
107 -- ----------------------------------------------------------------------------
108 -- |---------------------------------< lck >----------------------------------|
109 -- ----------------------------------------------------------------------------
110 Procedure lck
111 (p_window_property_id in number
112 ,p_language in varchar2
113 ) is
114 --
115 -- Cursor selects the 'current' row from the HR Schema
116 --
117 Cursor C_Sel1 is
118 select
119 window_property_id
120 ,language
121 ,source_lang
122 ,title
123 from hr_window_properties_tl
124 where window_property_id = p_window_property_id
125 and language = p_language
126 for update nowait;
127 --
128 l_proc varchar2(72) := g_package||'lck';
129 --
130 Begin
131 hr_utility.set_location('Entering:'||l_proc, 5);
132 --
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc
135 ,p_argument => 'WINDOW_PROPERTY_ID'
136 ,p_argument_value => p_window_property_id
137 );
138 hr_utility.set_location(l_proc,6);
139 hr_api.mandatory_arg_error
140 (p_api_name => l_proc
141 ,p_argument => 'LANGUAGE'
142 ,p_argument_value => p_language
143 );
144 --
145 Open C_Sel1;
146 Fetch C_Sel1 Into hr_wpt_shd.g_old_rec;
147 If C_Sel1%notfound then
148 Close C_Sel1;
149 --
150 -- The primary key is invalid therefore we must error
151 --
152 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
153 fnd_message.raise_error;
154 End If;
155 Close C_Sel1;
156 --
157 --
158 hr_utility.set_location(' Leaving:'||l_proc, 10);
159 --
160 -- We need to trap the ORA LOCK exception
161 --
162 Exception
163 When HR_Api.Object_Locked then
164 --
165 -- The object is locked therefore we need to supply a meaningful
166 -- error message.
167 --
168 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
169 fnd_message.set_token('TABLE_NAME', 'hr_window_properties_tl');
170 fnd_message.raise_error;
171 End lck;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |----------------------------< add_language >------------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure add_language is
177 --
178 cursor csr_window_properties is
179 select wpt.window_property_id
180 ,wpt.title
181 ,wpt.source_lang
182 from hr_window_properties_tl wpt
183 where wpt.language = userenv('LANG');
184 --
185 Begin
186 --
187 delete from hr_window_properties_tl t
188 where not exists
189 ( select null
190 from hr_window_properties_b b
191 where b.window_property_id = t.window_property_id
192 );
193
194 update hr_window_properties_tl t
195 set ( title ) =
196 ( select b.title
197 from hr_window_properties_tl b
198 where b.window_property_id = t.window_property_id
199 and b.language = t.source_lang )
200 where ( t.window_property_id,
201 t.language
202 ) in
203 ( select subt.window_property_id,
204 subt.language
205 from hr_window_properties_tl subb, hr_window_properties_tl subt
206 where subb.window_property_id = subt.window_property_id
207 and subb.language = subt.source_lang
208 and ( subb.title <> subt.title
209 or (subb.title is null and subt.title is not null)
210 or (subb.title is not null and subt.title is null)
211 )
212 );
213 --
214 --
215 for l_window_property in csr_window_properties loop
216 hr_wpt_ins.ins_tl
217 (p_language_code => l_window_property.source_lang
218 ,p_window_property_id => l_window_property.window_property_id
219 ,p_title => l_window_property.title
220 );
221 end loop;
222 --
223 End;
224 --
225 -- ----------------------------------------------------------------------------
226 -- |-----------------------------< convert_args >-----------------------------|
227 -- ----------------------------------------------------------------------------
228 Function convert_args
229 (p_window_property_id in number
230 ,p_language in varchar2
231 ,p_source_lang in varchar2
232 ,p_title in varchar2
233 )
234 Return g_rec_type is
235 --
236 l_rec g_rec_type;
237 --
238 Begin
239 --
240 -- Convert arguments into local l_rec structure.
241 --
242 l_rec.window_property_id := p_window_property_id;
243 l_rec.language := p_language;
244 l_rec.source_lang := p_source_lang;
245 l_rec.title := p_title;
246 --
247 -- Return the plsql record structure.
248 --
249 Return(l_rec);
250 --
251 End convert_args;
252 --
253 end hr_wpt_shd;