DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_CMC_SHD

Source


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