DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CIN_SHD

Source


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