DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PDC_SHD

Source


1 Package Body hr_pdc_shd as
2 /* $Header: hrpdcrhi.pkb 120.1 2005/09/27 06:23 adhunter noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_pdc_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 = 'HR_PERSON_DEPLYMT_CONTACTS_PK') 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   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_person_deplymt_contact_id            in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        person_deplymt_contact_id
50       ,person_deployment_id
51       ,contact_relationship_id
52       ,object_version_number
53     from        hr_person_deplymt_contacts
54     where       person_deplymt_contact_id = p_person_deplymt_contact_id;
55   --
56   l_fct_ret     boolean;
57   --
58 Begin
59   --
60   If (p_person_deplymt_contact_id is null and
61       p_object_version_number is null
62      ) Then
63     --
64     -- One of the primary key arguments is null therefore we must
65     -- set the returning function value to false
66     --
67     l_fct_ret := false;
68   Else
69     If (p_person_deplymt_contact_id
70         = hr_pdc_shd.g_old_rec.person_deplymt_contact_id and
71         p_object_version_number
72         = hr_pdc_shd.g_old_rec.object_version_number
73        ) Then
74       --
75       -- The g_old_rec is current therefore we must
76       -- set the returning function to true
77       --
78       l_fct_ret := true;
79     Else
80       --
81       -- Select the current row into g_old_rec
82       --
83       Open C_Sel1;
84       Fetch C_Sel1 Into hr_pdc_shd.g_old_rec;
85       If C_Sel1%notfound Then
86         Close C_Sel1;
87         --
88         -- The primary key is invalid therefore we must error
89         --
90         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
91         fnd_message.raise_error;
92       End If;
93       Close C_Sel1;
94       If (p_object_version_number
95           <> hr_pdc_shd.g_old_rec.object_version_number) Then
96         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
97         fnd_message.raise_error;
98       End If;
99       l_fct_ret := true;
100     End If;
101   End If;
102   Return (l_fct_ret);
103 --
104 End api_updating;
105 --
106 -- ----------------------------------------------------------------------------
107 -- |---------------------------------< lck >----------------------------------|
108 -- ----------------------------------------------------------------------------
109 Procedure lck
110   (p_person_deplymt_contact_id            in     number
111   ,p_object_version_number                in     number
112   ) is
113 --
114 -- Cursor selects the 'current' row from the HR Schema
115 --
116   Cursor C_Sel1 is
117     select
118        person_deplymt_contact_id
119       ,person_deployment_id
120       ,contact_relationship_id
121       ,object_version_number
122     from        hr_person_deplymt_contacts
123     where       person_deplymt_contact_id = p_person_deplymt_contact_id
124     for update nowait;
125 --
126   l_proc        varchar2(72) := g_package||'lck';
127 --
128 Begin
129   hr_utility.set_location('Entering:'||l_proc, 5);
130   --
131   hr_api.mandatory_arg_error
132     (p_api_name           => l_proc
133     ,p_argument           => 'PERSON_DEPLYMT_CONTACT_ID'
134     ,p_argument_value     => p_person_deplymt_contact_id
135     );
136   hr_utility.set_location(l_proc,6);
137   hr_api.mandatory_arg_error
138     (p_api_name           => l_proc
139     ,p_argument           => 'OBJECT_VERSION_NUMBER'
140     ,p_argument_value     => p_object_version_number
141     );
142   --
143   Open  C_Sel1;
144   Fetch C_Sel1 Into hr_pdc_shd.g_old_rec;
145   If C_Sel1%notfound then
146     Close C_Sel1;
147     --
148     -- The primary key is invalid therefore we must error
149     --
150     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
151     fnd_message.raise_error;
152   End If;
153   Close C_Sel1;
154   If (p_object_version_number
155       <> hr_pdc_shd.g_old_rec.object_version_number) Then
156         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
157         fnd_message.raise_error;
158   End If;
159   --
160   hr_utility.set_location(' Leaving:'||l_proc, 10);
161   --
162   -- We need to trap the ORA LOCK exception
163   --
164 Exception
165   When HR_Api.Object_Locked then
166     --
167     -- The object is locked therefore we need to supply a meaningful
168     -- error message.
169     --
170     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
171     fnd_message.set_token('TABLE_NAME', 'hr_person_deplymt_contacts');
172     fnd_message.raise_error;
173 End lck;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |-----------------------------< convert_args >-----------------------------|
177 -- ----------------------------------------------------------------------------
178 Function convert_args
179   (p_person_deplymt_contact_id      in number
180   ,p_person_deployment_id           in number
181   ,p_contact_relationship_id        in number
182   ,p_object_version_number          in number
183   )
184   Return g_rec_type is
185 --
186   l_rec   g_rec_type;
187 --
188 Begin
189   --
190   -- Convert arguments into local l_rec structure.
191   --
192   l_rec.person_deplymt_contact_id        := p_person_deplymt_contact_id;
193   l_rec.person_deployment_id             := p_person_deployment_id;
194   l_rec.contact_relationship_id          := p_contact_relationship_id;
195   l_rec.object_version_number            := p_object_version_number;
196   --
197   -- Return the plsql record structure.
198   --
199   Return(l_rec);
200 --
201 End convert_args;
202 --
203 end hr_pdc_shd;