[Home] [Help]
PACKAGE BODY: APPS.OTA_FOI_SHD
Source
1 Package Body ota_foi_shd as
2 /* $Header: otfoirhi.pkb 120.3 2005/08/12 02:45 pchandra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_foi_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 = 'OTA_FOBJINCL_OBJECT_TYPE_CHK') 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 = 'OTA_FRM_OBJ_INCLUSIONS_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_forum_id in number
45 ,p_object_id in number
46 ,p_object_type in varchar2
47 ,p_object_version_number in number
48 )
49 Return Boolean Is
50 --
51 --
52 -- Cursor selects the 'current' row from the HR Schema
53 --
54 Cursor C_Sel1 is
55 select
56 forum_id
57 ,object_id
58 ,object_type
59 ,start_date_active
60 ,end_date_active
61 ,primary_flag
62 ,object_version_number
63 from ota_frm_obj_inclusions
64 where forum_id = p_forum_id
65 and object_id = p_object_id
66 and object_type = p_object_type;
67 --
68 l_fct_ret boolean;
69 --
70 Begin
71 --
72 If (p_forum_id is null and
73 p_object_id is null and
74 p_object_type is null and
75 p_object_version_number is null
76 ) Then
77 --
78 -- One of the primary key arguments is null therefore we must
79 -- set the returning function value to false
80 --
81 l_fct_ret := false;
82 Else
83 If (p_forum_id
84 = ota_foi_shd.g_old_rec.forum_id and
85 p_object_id
86 = ota_foi_shd.g_old_rec.object_id and
87 p_object_type
88 = ota_foi_shd.g_old_rec.object_type and
89 p_object_version_number
90 = ota_foi_shd.g_old_rec.object_version_number
91 ) Then
92 --
93 -- The g_old_rec is current therefore we must
94 -- set the returning function to true
95 --
96 l_fct_ret := true;
97 Else
98 --
99 -- Select the current row into g_old_rec
100 --
101 Open C_Sel1;
102 Fetch C_Sel1 Into ota_foi_shd.g_old_rec;
103 If C_Sel1%notfound Then
104 Close C_Sel1;
105 --
106 -- The primary key is invalid therefore we must error
107 --
108 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
109 fnd_message.raise_error;
110 End If;
111 Close C_Sel1;
112 If (p_object_version_number
113 <> ota_foi_shd.g_old_rec.object_version_number) Then
114 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
115 fnd_message.raise_error;
116 End If;
117 l_fct_ret := true;
118 End If;
119 End If;
120 Return (l_fct_ret);
121 --
122 End api_updating;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |---------------------------------< lck >----------------------------------|
126 -- ----------------------------------------------------------------------------
127 Procedure lck
128 (p_forum_id in number
129 ,p_object_id in number
130 ,p_object_type in varchar2
131 ,p_object_version_number in number
132 ) is
133 --
134 -- Cursor selects the 'current' row from the HR Schema
135 --
136 Cursor C_Sel1 is
137 select
138 forum_id
139 ,object_id
140 ,object_type
141 ,start_date_active
142 ,end_date_active
143 ,primary_flag
144 ,object_version_number
145 from ota_frm_obj_inclusions
146 where forum_id = p_forum_id
147 and object_id = p_object_id
148 and object_type = p_object_type
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 hr_api.mandatory_arg_error
157 (p_api_name => l_proc
158 ,p_argument => 'FORUM_ID'
159 ,p_argument_value => p_forum_id
160 );
161 hr_utility.set_location(l_proc,6);
162 hr_api.mandatory_arg_error
163 (p_api_name => l_proc
164 ,p_argument => 'OBJECT_ID'
165 ,p_argument_value => p_object_id
166 );
167 hr_utility.set_location(l_proc,7);
168 hr_api.mandatory_arg_error
169 (p_api_name => l_proc
170 ,p_argument => 'OBJECT_TYPE'
171 ,p_argument_value => p_object_type
172 );
173 hr_utility.set_location(l_proc,8);
174 hr_api.mandatory_arg_error
175 (p_api_name => l_proc
176 ,p_argument => 'OBJECT_VERSION_NUMBER'
177 ,p_argument_value => p_object_version_number
178 );
179 --
180 Open C_Sel1;
181 Fetch C_Sel1 Into ota_foi_shd.g_old_rec;
182 If C_Sel1%notfound then
183 Close C_Sel1;
184 --
185 -- The primary key is invalid therefore we must error
186 --
187 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
188 fnd_message.raise_error;
189 End If;
190 Close C_Sel1;
191 If (p_object_version_number
192 <> ota_foi_shd.g_old_rec.object_version_number) Then
193 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
194 fnd_message.raise_error;
195 End If;
196 --
197 hr_utility.set_location(' Leaving:'||l_proc, 10);
198 --
199 -- We need to trap the ORA LOCK exception
200 --
201 Exception
202 When HR_Api.Object_Locked then
203 --
204 -- The object is locked therefore we need to supply a meaningful
205 -- error message.
206 --
207 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
208 fnd_message.set_token('TABLE_NAME', 'ota_frm_obj_inclusions');
209 fnd_message.raise_error;
210 End lck;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |-----------------------------< convert_args >-----------------------------|
214 -- ----------------------------------------------------------------------------
215 Function convert_args
216 (p_forum_id in number
217 ,p_object_id in number
218 ,p_object_type in varchar2
219 ,p_start_date_active in date
220 ,p_end_date_active in date
221 ,p_primary_flag in varchar2
222 ,p_object_version_number in number
223 )
224 Return g_rec_type is
225 --
226 l_rec g_rec_type;
227 --
228 Begin
229 --
230 -- Convert arguments into local l_rec structure.
231 --
232 l_rec.forum_id := p_forum_id;
233 l_rec.object_id := p_object_id;
234 l_rec.object_type := p_object_type;
235 l_rec.start_date_active := p_start_date_active;
236 l_rec.end_date_active := p_end_date_active;
237 l_rec.primary_flag := p_primary_flag;
238 l_rec.object_version_number := p_object_version_number;
239 --
240 -- Return the plsql record structure.
241 --
242 Return(l_rec);
243 --
244 End convert_args;
245 --
246 end ota_foi_shd;