DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_CMT_SHD

Source


1 Package Body irc_cmt_shd as
2 /* $Header: ircmtrhi.pkb 120.1 2008/03/18 14:03:16 amikukum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_cmt_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_TOPICS_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_TOPICS_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_topic_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_topic_id
55       ,communication_id
56       ,subject
57       ,status
58       ,object_version_number
59     from        irc_comm_topics
60     where       communication_topic_id = p_communication_topic_id;
61   --
62   l_fct_ret     boolean;
63   --
64 Begin
65   --
66   If (p_communication_topic_id is null and
67       p_object_version_number is null
68      ) Then
69     --
70     -- One of the primary key arguments is null therefore we must
71     -- set the returning function value to false
72     --
73     l_fct_ret := false;
74   Else
75     If (p_communication_topic_id
76         = irc_cmt_shd.g_old_rec.communication_topic_id and
77         p_object_version_number
78         = irc_cmt_shd.g_old_rec.object_version_number
79        ) Then
80       --
81       -- The g_old_rec is current therefore we must
82       -- set the returning function to true
83       --
84       l_fct_ret := true;
85     Else
86       --
87       -- Select the current row into g_old_rec
88       --
89       Open C_Sel1;
90       Fetch C_Sel1 Into irc_cmt_shd.g_old_rec;
91       If C_Sel1%notfound Then
92         Close C_Sel1;
93         --
94         -- The primary key is invalid therefore we must error
95         --
96         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
97         fnd_message.raise_error;
98       End If;
99       Close C_Sel1;
100       If (p_object_version_number
101           <> irc_cmt_shd.g_old_rec.object_version_number) Then
102         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
103         fnd_message.raise_error;
104       End If;
105       l_fct_ret := true;
106     End If;
107   End If;
108   Return (l_fct_ret);
109 --
110 End api_updating;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |---------------------------------< lck >----------------------------------|
114 -- ----------------------------------------------------------------------------
115 Procedure lck
116   (p_communication_topic_id               in     number
117   ,p_object_version_number                in     number
118   ) is
119 --
120 -- Cursor selects the 'current' row from the HR Schema
121 --
122   Cursor C_Sel1 is
123     select
124        communication_topic_id
125       ,communication_id
126       ,subject
127       ,status
128       ,object_version_number
129     from        irc_comm_topics
130     where       communication_topic_id = p_communication_topic_id
131     for update nowait;
132 --
133   l_proc        varchar2(72) := g_package||'lck';
134 --
135 Begin
136   hr_utility.set_location('Entering:'||l_proc, 5);
137   --
138   hr_api.mandatory_arg_error
139     (p_api_name           => l_proc
140     ,p_argument           => 'COMMUNICATION_TOPIC_ID'
141     ,p_argument_value     => p_communication_topic_id
142     );
143   hr_utility.set_location(l_proc,6);
144   hr_api.mandatory_arg_error
145     (p_api_name           => l_proc
146     ,p_argument           => 'OBJECT_VERSION_NUMBER'
147     ,p_argument_value     => p_object_version_number
148     );
149   --
150   Open  C_Sel1;
151   Fetch C_Sel1 Into irc_cmt_shd.g_old_rec;
152   If C_Sel1%notfound then
153     Close C_Sel1;
154     --
155     -- The primary key is invalid therefore we must error
156     --
157     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
158     fnd_message.raise_error;
159   End If;
160   Close C_Sel1;
161   If (p_object_version_number
162       <> irc_cmt_shd.g_old_rec.object_version_number) Then
163         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
164         fnd_message.raise_error;
165   End If;
166   --
167   hr_utility.set_location(' Leaving:'||l_proc, 10);
168   --
169   -- We need to trap the ORA LOCK exception
170   --
171 Exception
172   When HR_Api.Object_Locked then
173     --
174     -- The object is locked therefore we need to supply a meaningful
175     -- error message.
176     --
177     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
178     fnd_message.set_token('TABLE_NAME', 'irc_comm_topics');
179     fnd_message.raise_error;
180 End lck;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------------< convert_args >-----------------------------|
184 -- ----------------------------------------------------------------------------
185 Function convert_args
186   (p_communication_topic_id         in number
187   ,p_communication_id               in number
188   ,p_subject                        in varchar2
189   ,p_status                         in varchar2
190   ,p_object_version_number          in number
191   )
192   Return g_rec_type is
193 --
194   l_rec   g_rec_type;
195 --
196 Begin
197   --
198   -- Convert arguments into local l_rec structure.
199   --
200   l_rec.communication_topic_id           := p_communication_topic_id;
201   l_rec.communication_id                 := p_communication_id;
202   l_rec.subject                          := p_subject;
203   l_rec.status                           := p_status;
204   l_rec.object_version_number            := p_object_version_number;
205   --
206   -- Return the plsql record structure.
207   --
208   Return(l_rec);
209 --
210 End convert_args;
211 --
212 end irc_cmt_shd;