DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CCL_SHD

Source


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