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