1 Package per_par_shd as
2 /* $Header: peparrhi.pkh 120.1 2007/06/20 07:48:33 rapandi ship $ */
3 -- ----------------------------------------------------------------------------
4 -- | Global Record Type Specification |
5 -- ----------------------------------------------------------------------------
6 Type g_rec_type Is Record
7 (
8 participant_id number(15),
9 business_group_id number(15),
10 object_version_number number(9),
11 questionnaire_template_id number(15),
12 participation_in_table varchar2(80),
13 participation_in_column varchar2(80),
14 participation_in_id number(15),
15 participation_status varchar2(30),
16 participation_type varchar2(30),
17 last_notified_date date,
18 date_completed date,
19 comments varchar2(2000), -- pseudo column
20 person_id number(15),
21 attribute_category varchar2(30),
22 attribute1 varchar2(150),
23 attribute2 varchar2(150),
24 attribute3 varchar2(150),
25 attribute4 varchar2(150),
26 attribute5 varchar2(150),
27 attribute6 varchar2(150),
28 attribute7 varchar2(150),
29 attribute8 varchar2(150),
30 attribute9 varchar2(150),
31 attribute10 varchar2(150),
32 attribute11 varchar2(150),
33 attribute12 varchar2(150),
34 attribute13 varchar2(150),
35 attribute14 varchar2(150),
36 attribute15 varchar2(150),
37 attribute16 varchar2(150),
38 attribute17 varchar2(150),
39 attribute18 varchar2(150),
40 attribute19 varchar2(150),
41 attribute20 varchar2(150),
42 participant_usage_status varchar2(30)
43 );
44 --
45 -- ----------------------------------------------------------------------------
46 -- | Global Definitions - Internal Development Use Only |
47 -- ----------------------------------------------------------------------------
48 --
49 g_old_rec g_rec_type; -- Global record definition
50 g_tab_nam constant varchar2(30) := 'PER_PARTICIPANTS';
51 --
52 --
53 --
54 -- ----------------------------------------------------------------------------
55 -- |---------------------------< constraint_error >---------------------------|
56 -- ----------------------------------------------------------------------------
57 -- {Start Of Comments}
58 --
59 -- Description:
60 -- This procedure is called when a constraint has been violated (i.e.
61 -- The exception hr_api.check_integrity_violated,
62 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
63 -- hr_api.unique_integrity_violated has been raised).
64 -- The exceptions can only be raised as follows:
65 -- 1) A check constraint can only be violated during an INSERT or UPDATE
66 -- dml operation.
67 -- 2) A parent integrity constraint can only be violated during an
68 -- INSERT or UPDATE dml operation.
69 -- 3) A child integrity constraint can only be violated during an
70 -- DELETE dml operation.
71 -- 4) A unique integrity constraint can only be violated during INSERT or
72 -- UPDATE dml operation.
73 --
74 -- Pre Conditions:
75 -- 1) Either hr_api.check_integrity_violated,
76 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
77 -- hr_api.unique_integrity_violated has been raised with the subsequent
78 -- stripping of the constraint name from the generated error message
79 -- text.
80 -- 2) Standalone validation test which corresponds with a constraint error.
81 --
82 -- In Parameter:
83 -- p_constraint_name is in upper format and is just the constraint name
84 -- (e.g. not prefixed by brackets, schema owner etc).
85 --
86 -- Post Success:
87 -- Development dependant.
88 --
89 -- Post Failure:
90 -- Developement dependant.
91 --
92 -- Developer Implementation Notes:
93 -- For each constraint being checked the hr system package failure message
94 -- has been generated as a template only. These system error messages should
95 -- be modified as required (i.e. change the system failure message to a user
96 -- friendly defined error message).
97 --
98 -- Access Status:
99 -- Internal Development Use Only.
100 --
101 -- {End Of Comments}
102 -- ----------------------------------------------------------------------------
103 Procedure constraint_error
104 (p_constraint_name in all_constraints.constraint_name%TYPE);
105 --
106 -- ----------------------------------------------------------------------------
107 -- |-----------------------------< api_updating >-----------------------------|
108 -- ----------------------------------------------------------------------------
109 -- {Start Of Comments}
110 --
111 -- Description:
112 -- This function is used to populate the g_old_rec record with the
113 -- current row from the database for the specified primary key
114 -- provided that the primary key exists and is valid and does not
115 -- already match the current g_old_rec. The function will always return
116 -- a TRUE value if the g_old_rec is populated with the current row.
117 -- A FALSE value will be returned if all of the primary key arguments
118 -- are null.
119 --
120 -- Pre Conditions:
121 -- None.
122 --
123 -- In Parameters:
124 --
125 -- Post Success:
126 -- A value of TRUE will be returned indiciating that the g_old_rec
127 -- is current.
128 -- A value of FALSE will be returned if all of the primary key arguments
129 -- have a null value (this indicates that the row has not be inserted into
130 -- the Schema), and therefore could never have a corresponding row.
131 --
132 -- Post Failure:
133 -- A failure can only occur under two circumstances:
134 -- 1) The primary key is invalid (i.e. a row does not exist for the
135 -- specified primary key values).
136 -- 2) If an object_version_number exists but is NOT the same as the current
137 -- g_old_rec value.
138 --
139 -- Developer Implementation Notes:
140 -- None.
141 --
142 -- Access Status:
143 -- Internal Development Use Only.
144 --
145 -- {End Of Comments}
146 -- ----------------------------------------------------------------------------
147 Function api_updating
148 (
149 p_participant_id in number,
150 p_object_version_number in number
151 ) Return Boolean;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |---------------------------------< lck >----------------------------------|
155 -- ----------------------------------------------------------------------------
156 -- {Start Of Comments}
157 --
158 -- Description:
159 -- The Lck process has two main functions to perform. Firstly, the row to be
160 -- updated or deleted must be locked. The locking of the row will only be
161 -- successful if the row is not currently locked by another user.
162 -- Secondly, during the locking of the row, the row is selected into
163 -- the g_old_rec data structure which enables the current row values from the
164 -- server to be available to the api.
165 --
166 -- Pre Conditions:
167 -- When attempting to call the lock the object version number (if defined)
168 -- is mandatory.
169 --
170 -- In Parameters:
171 -- The arguments to the Lck process are the primary key(s) which uniquely
172 -- identify the row and the object version number of row.
173 --
174 -- Post Success:
175 -- On successful completion of the Lck process the row to be updated or
176 -- deleted will be locked and selected into the global data structure
177 -- g_old_rec.
178 --
179 -- Post Failure:
180 -- The Lck process can fail for three reasons:
181 -- 1) When attempting to lock the row the row could already be locked by
182 -- another user. This will raise the HR_Api.Object_Locked exception.
183 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
184 -- This error is trapped and reported using the message name
185 -- 'HR_7220_INVALID_PRIMARY_KEY'.
186 -- 3) The row although existing in the HR Schema has a different object
187 -- version number than the object version number specified.
188 -- This error is trapped and reported using the message name
189 -- 'HR_7155_OBJECT_INVALID'.
190 --
191 -- Developer Implementation Notes:
192 -- For each primary key and the object version number arguments add a
193 -- call to hr_api.mandatory_arg_error procedure to ensure that these
194 -- argument values are not null.
195 --
196 -- Access Status:
197 -- Internal Development Use Only.
198 --
199 -- {End Of Comments}
200 -- ----------------------------------------------------------------------------
201 Procedure lck
202 (
203 p_participant_id in number,
204 p_object_version_number in number
205 );
206 --
207 -- ----------------------------------------------------------------------------
208 -- |-----------------------------< convert_args >-----------------------------|
209 -- ----------------------------------------------------------------------------
210 -- {Start Of Comments}
211 --
212 -- Description:
213 -- This function is used to turn attribute parameters into the record
214 -- structure parameter g_rec_type.
215 --
216 -- Pre Conditions:
217 -- This is a private function and can only be called from the ins or upd
218 -- attribute processes.
219 --
220 -- In Parameters:
221 --
222 -- Post Success:
223 -- A returning record structure will be returned.
224 --
225 -- Post Failure:
226 -- No direct error handling is required within this function. Any possible
227 -- errors within this function will be a PL/SQL value error due to conversion
228 -- of datatypes or data lengths.
229 --
230 -- Developer Implementation Notes:
231 -- None.
232 --
233 -- Access Status:
234 -- Internal Table Handler Use Only.
235 --
236 -- {End Of Comments}
237 -- ----------------------------------------------------------------------------
238 Function convert_args
239 (
240 p_participant_id in number,
241 p_business_group_id in number,
242 p_object_version_number in number,
243 p_questionnaire_template_id in number,
244 p_participation_in_table in varchar2,
245 p_participation_in_column in varchar2,
246 p_participation_in_id in number,
247 p_participation_status in varchar2,
248 p_participation_type in varchar2,
249 p_last_notified_date in date,
250 p_date_completed in date,
251 p_comments in varchar2,
252 p_person_id in number,
253 p_attribute_category in varchar2,
254 p_attribute1 in varchar2,
255 p_attribute2 in varchar2,
256 p_attribute3 in varchar2,
257 p_attribute4 in varchar2,
258 p_attribute5 in varchar2,
259 p_attribute6 in varchar2,
260 p_attribute7 in varchar2,
261 p_attribute8 in varchar2,
262 p_attribute9 in varchar2,
263 p_attribute10 in varchar2,
264 p_attribute11 in varchar2,
265 p_attribute12 in varchar2,
266 p_attribute13 in varchar2,
267 p_attribute14 in varchar2,
268 p_attribute15 in varchar2,
269 p_attribute16 in varchar2,
270 p_attribute17 in varchar2,
271 p_attribute18 in varchar2,
272 p_attribute19 in varchar2,
273 p_attribute20 in varchar2,
274 p_participant_usage_status in varchar2
275 )
276 Return g_rec_type;
277 --
278 end per_par_shd;