[Home] [Help]
PACKAGE BODY: APPS.HXC_HRT_SHD
Source
1 Package Body hxc_hrt_shd as
2 /* $Header: hxchrtrhi.pkb 120.2 2005/09/23 10:44:26 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_hrt_shd.'; -- Global package name
9 g_debug boolean :=hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE
16 ) Is
17 --
18 l_proc varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21 --
22 If (p_constraint_name = 'HXC_RETRIEVAL_PROCESSES_FK1') Then
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 ElsIf (p_constraint_name = 'HXC_RETRIEVAL_PROCESSES_PK') Then
28 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('STEP','10');
31 fnd_message.raise_error;
32 Else
33 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
36 fnd_message.raise_error;
37 End If;
38 --
39 End constraint_error;
40 --
41 -- ----------------------------------------------------------------------------
42 -- |-----------------------------< api_updating >-----------------------------|
43 -- ----------------------------------------------------------------------------
44 Function api_updating
45 (p_retrieval_process_id in number
46 ,p_object_version_number in number
47 )
48 Return Boolean Is
49 --
50 --
51 -- Cursor selects the 'current' row from the HR Schema
52 --
53 Cursor C_Sel1 is
54 select
55 retrieval_process_id
56 ,time_recipient_id
57 ,name
58 ,mapping_id
59 ,object_version_number
60 from hxc_retrieval_processes
61 where retrieval_process_id = p_retrieval_process_id;
62 --
63 l_fct_ret boolean;
64 --
65 Begin
66 --
67 If (p_retrieval_process_id is null and
68 p_object_version_number is null
69 ) Then
70 --
71 -- One of the primary key arguments is null therefore we must
72 -- set the returning function value to false
73 --
74 l_fct_ret := false;
75 Else
76 If (p_retrieval_process_id
77 = hxc_hrt_shd.g_old_rec.retrieval_process_id and
78 p_object_version_number
79 = hxc_hrt_shd.g_old_rec.object_version_number
80 ) Then
81 --
82 -- The g_old_rec is current therefore we must
83 -- set the returning function to true
84 --
85 l_fct_ret := true;
86 Else
87 --
88 -- Select the current row into g_old_rec
89 --
90 Open C_Sel1;
91 Fetch C_Sel1 Into hxc_hrt_shd.g_old_rec;
92 If C_Sel1%notfound Then
93 Close C_Sel1;
94 --
95 -- The primary key is invalid therefore we must error
96 --
97 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
98 fnd_message.raise_error;
99 End If;
100 Close C_Sel1;
101 If (p_object_version_number
102 <> hxc_hrt_shd.g_old_rec.object_version_number) Then
103 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
104 fnd_message.raise_error;
105 End If;
106 l_fct_ret := true;
107 End If;
108 End If;
109 Return (l_fct_ret);
110 --
111 End api_updating;
112 --
113 -- ----------------------------------------------------------------------------
114 -- |---------------------------------< lck >----------------------------------|
115 -- ----------------------------------------------------------------------------
116 Procedure lck
117 (p_retrieval_process_id in number
118 ,p_object_version_number in number
119 ) is
120 --
121 -- Cursor selects the 'current' row from the HR Schema
122 --
123 Cursor C_Sel1 is
124 select
125 retrieval_process_id
126 ,time_recipient_id
127 ,name
128 ,mapping_id
129 ,object_version_number
130 from hxc_retrieval_processes
131 where retrieval_process_id = p_retrieval_process_id
132 for update nowait;
133 --
134 l_proc varchar2(72);
135 --
136 Begin
137 g_debug:=hr_utility.debug_enabled;
138 if g_debug then
139 l_proc := g_package||'lck';
140 hr_utility.set_location('Entering:'||l_proc, 5);
141 end if;
142 --
143 hr_api.mandatory_arg_error
144 (p_api_name => l_proc
145 ,p_argument => 'RETRIEVAL_PROCESS_ID'
146 ,p_argument_value => p_retrieval_process_id
147 );
148 --
149 Open C_Sel1;
150 Fetch C_Sel1 Into hxc_hrt_shd.g_old_rec;
151 If C_Sel1%notfound then
152 Close C_Sel1;
153 --
154 -- The primary key is invalid therefore we must error
155 --
156 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157 fnd_message.raise_error;
158 End If;
159 Close C_Sel1;
160 If (p_object_version_number
161 <> hxc_hrt_shd.g_old_rec.object_version_number) Then
162 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163 fnd_message.raise_error;
164 End If;
165 --
166 if g_debug then
167 hr_utility.set_location(' Leaving:'||l_proc, 10);
168 end if;
169 --
170 -- We need to trap the ORA LOCK exception
171 --
172 Exception
173 When HR_Api.Object_Locked then
174 --
175 -- The object is locked therefore we need to supply a meaningful
176 -- error message.
177 --
178 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
179 fnd_message.set_token('TABLE_NAME', 'hxc_retrieval_processes');
180 fnd_message.raise_error;
181 End lck;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |-----------------------------< convert_args >-----------------------------|
185 -- ----------------------------------------------------------------------------
186 Function convert_args
187 (p_retrieval_process_id in number
188 ,p_time_recipient_id in number
189 ,p_name in varchar2
190 ,p_mapping_id in number
191 ,p_object_version_number in number
192 )
193 Return g_rec_type is
194 --
195 l_rec g_rec_type;
196 --
197 Begin
198 --
199 -- Convert arguments into local l_rec structure.
200 --
201 l_rec.retrieval_process_id := p_retrieval_process_id;
202 l_rec.time_recipient_id := p_time_recipient_id;
203 l_rec.name := p_name;
204 l_rec.mapping_id := p_mapping_id;
205 l_rec.object_version_number := p_object_version_number;
206 --
207 -- Return the plsql record structure.
208 --
209 Return(l_rec);
210 --
211 End convert_args;
212 --
213 end hxc_hrt_shd;