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