DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_CMM_SHD

Source


1 Package Body irc_cmm_shd as
2 /* $Header: ircmmrhi.pkb 120.2 2008/04/14 14:50:29 amikukum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_cmm_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 = 'IRC_COMM_MESSAGES_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 = 'IRC_COMM_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_communication_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        communication_message_id
55       ,parent_id
56       ,communication_topic_id
57       ,message_subject
58       ,message_body
59       ,message_post_date
60       ,sender_type
61       ,sender_id
62       ,document_type
63       ,document_id
64       ,deleted_flag
65       ,object_version_number
66     from        irc_comm_messages
67     where       communication_message_id = p_communication_message_id;
68   --
69   l_fct_ret     boolean;
70   --
71 Begin
72   --
73   If (p_communication_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_communication_message_id
83         = irc_cmm_shd.g_old_rec.communication_message_id and
84         p_object_version_number
85         = irc_cmm_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 irc_cmm_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           <> irc_cmm_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_communication_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        communication_message_id
132       ,parent_id
133       ,communication_topic_id
134       ,message_subject
135       ,message_body
136       ,message_post_date
137       ,sender_type
138       ,sender_id
139       ,document_type
140       ,document_id
141       ,deleted_flag
142       ,object_version_number
143     from        irc_comm_messages
144     where       communication_message_id = p_communication_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           => 'COMMUNICATION_MESSAGE_ID'
155     ,p_argument_value     => p_communication_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 irc_cmm_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       <> irc_cmm_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', 'irc_comm_messages');
193     fnd_message.raise_error;
194 End lck;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |-----------------------------< convert_args >-----------------------------|
198 -- ----------------------------------------------------------------------------
199 Function convert_args
200   (p_communication_message_id       in number
201   ,p_parent_id                      in number
202   ,p_communication_topic_id         in number
203   ,p_message_subject                in varchar2
204   ,p_message_body                   in varchar2
205   ,p_message_post_date              in date
206   ,p_sender_type                    in varchar2
207   ,p_sender_id                      in number
208   ,p_document_type                  in varchar2
209   ,p_document_id                    in number
210   ,p_deleted_flag                   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.communication_message_id         := p_communication_message_id;
222   l_rec.parent_id                        := p_parent_id;
223   l_rec.communication_topic_id           := p_communication_topic_id;
224   l_rec.message_subject                  := p_message_subject;
225   l_rec.message_body                     := p_message_body;
226   l_rec.message_post_date                := p_message_post_date;
227   l_rec.sender_type                      := p_sender_type;
228   l_rec.sender_id                        := p_sender_id;
229   l_rec.document_type                    := p_document_type;
230   l_rec.document_id                      := p_document_id;
231   l_rec.deleted_flag                     := p_deleted_flag;
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 irc_cmm_shd;