1 Package per_gra_shd as
2 /* $Header: pegrarhi.pkh 120.0 2005/05/31 09:28:31 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 cagr_grade_id number(15),
11 cagr_grade_structure_id number(15),
12 cagr_grade_def_id number(15),
13 sequence number(15),
14 object_version_number number(15)
15 );
16 --
17 -- ----------------------------------------------------------------------------
18 -- | Global Definitions - Internal Development Use Only |
19 -- ----------------------------------------------------------------------------
20 --
21 g_old_rec g_rec_type; -- Global record definition
22 g_api_dml boolean; -- Global api dml status
23 --
24 -- ----------------------------------------------------------------------------
25 -- |------------------------< return_api_dml_status >-------------------------|
26 -- ----------------------------------------------------------------------------
27 -- {Start Of Comments}
28 --
29 -- Description:
30 -- This function will return the current g_api_dml private global
31 -- boolean status.
32 -- The g_api_dml status determines if at the time of the function
33 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
34 -- is being issued from within an api.
35 -- If the status is TRUE then a dml statement is being issued from
36 -- within this entity api.
37 -- This function is primarily to support database triggers which
38 -- need to maintain the object_version_number for non-supported
39 -- dml statements (i.e. dml statement issued outside of the api layer).
40 --
41 -- Prerequisites:
42 -- None.
43 --
44 -- In Parameters:
45 -- None.
46 --
47 -- Post Success:
48 -- Processing continues.
49 -- If the function returns a TRUE value then, dml is being executed from
50 -- within this api.
51 --
52 -- Post Failure:
53 -- None.
54 --
55 -- Access Status:
56 -- Internal Row Handler Use Only.
57 --
58 -- {End Of Comments}
59 -- ----------------------------------------------------------------------------
60 Function return_api_dml_status Return Boolean;
61 --
62 -- ----------------------------------------------------------------------------
63 -- |---------------------------< constraint_error >---------------------------|
64 -- ----------------------------------------------------------------------------
65 -- {Start Of Comments}
66 --
67 -- Description:
68 -- This procedure is called when a constraint has been violated (i.e.
69 -- The exception hr_api.check_integrity_violated,
70 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
71 -- hr_api.unique_integrity_violated has been raised).
72 -- The exceptions can only be raised as follows:
73 -- 1) A check constraint can only be violated during an INSERT or UPDATE
74 -- dml operation.
75 -- 2) A parent integrity constraint can only be violated during an
76 -- INSERT or UPDATE dml operation.
77 -- 3) A child integrity constraint can only be violated during an
78 -- DELETE dml operation.
79 -- 4) A unique integrity constraint can only be violated during INSERT or
80 -- UPDATE dml operation.
81 --
82 -- Prerequisites:
83 -- 1) Either hr_api.check_integrity_violated,
84 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
85 -- hr_api.unique_integrity_violated has been raised with the subsequent
86 -- stripping of the constraint name from the generated error message
87 -- text.
88 -- 2) Standalone validation test which corresponds with a constraint error.
89 --
90 -- In Parameter:
91 -- p_constraint_name is in upper format and is just the constraint name
92 -- (e.g. not prefixed by brackets, schema owner etc).
93 --
94 -- Post Success:
95 -- Development dependant.
96 --
97 -- Post Failure:
98 -- Developement dependant.
99 --
100 -- Developer Implementation Notes:
101 -- For each constraint being checked the hr system package failure message
102 -- has been generated as a template only. These system error messages should
103 -- be modified as required (i.e. change the system failure message to a user
104 -- friendly defined error message).
105 --
106 -- Access Status:
107 -- Internal Development Use Only.
108 --
109 -- {End Of Comments}
110 -- ----------------------------------------------------------------------------
111 Procedure constraint_error
112 (p_constraint_name in all_constraints.constraint_name%TYPE);
113 --
114 -- ----------------------------------------------------------------------------
115 -- |-----------------------------< api_updating >-----------------------------|
116 -- ----------------------------------------------------------------------------
117 -- {Start Of Comments}
118 --
119 -- Description:
120 -- This function is used to populate the g_old_rec record with the
121 -- current row from the database for the specified primary key
122 -- provided that the primary key exists and is valid and does not
123 -- already match the current g_old_rec. The function will always return
124 -- a TRUE value if the g_old_rec is populated with the current row.
125 -- A FALSE value will be returned if all of the primary key arguments
126 -- are null.
127 --
128 -- Prerequisites:
129 -- None.
130 --
131 -- In Parameters:
132 --
133 -- Post Success:
134 -- A value of TRUE will be returned indiciating that the g_old_rec
135 -- is current.
136 -- A value of FALSE will be returned if all of the primary key arguments
137 -- have a null value (this indicates that the row has not be inserted into
138 -- the Schema), and therefore could never have a corresponding row.
139 --
140 -- Post Failure:
141 -- A failure can only occur under two circumstances:
142 -- 1) The primary key is invalid (i.e. a row does not exist for the
143 -- specified primary key values).
144 -- 2) If an object_version_number exists but is NOT the same as the current
145 -- g_old_rec value.
146 --
147 -- Developer Implementation Notes:
148 -- None.
149 --
150 -- Access Status:
151 -- Internal Development Use Only.
152 --
153 -- {End Of Comments}
154 -- ----------------------------------------------------------------------------
155 Function api_updating
156 (
157 p_cagr_grade_id in number,
158 p_object_version_number in number,
159 p_effective_date in date
160 ) Return Boolean;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |---------------------------------< lck >----------------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 -- The Lck process has two main functions to perform. Firstly, the row to be
169 -- updated or deleted must be locked. The locking of the row will only be
170 -- successful if the row is not currently locked by another user.
171 -- Secondly, during the locking of the row, the row is selected into
172 -- the g_old_rec data structure which enables the current row values from the
173 -- server to be available to the api.
174 --
175 -- Prerequisites:
176 -- When attempting to call the lock the object version number (if defined)
177 -- is mandatory.
178 --
179 -- In Parameters:
180 -- The arguments to the Lck process are the primary key(s) which uniquely
181 -- identify the row and the object version number of row.
182 --
183 -- Post Success:
184 -- On successful completion of the Lck process the row to be updated or
185 -- deleted will be locked and selected into the global data structure
186 -- g_old_rec.
187 --
188 -- Post Failure:
189 -- The Lck process can fail for three reasons:
190 -- 1) When attempting to lock the row the row could already be locked by
191 -- another user. This will raise the HR_Api.Object_Locked exception.
192 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
193 -- This error is trapped and reported using the message name
194 -- 'HR_7220_INVALID_PRIMARY_KEY'.
195 -- 3) The row although existing in the HR Schema has a different object
196 -- version number than the object version number specified.
197 -- This error is trapped and reported using the message name
198 -- 'HR_7155_OBJECT_INVALID'.
199 --
200 -- Developer Implementation Notes:
201 -- For each primary key and the object version number arguments add a
202 -- call to hr_api.mandatory_arg_error procedure to ensure that these
203 -- argument values are not null.
204 --
205 -- Access Status:
206 -- Internal Development Use Only.
207 --
208 -- {End Of Comments}
209 -- ----------------------------------------------------------------------------
210 Procedure lck
211 (
212 p_cagr_grade_id in number,
213 p_object_version_number in number,
214 p_effective_date in date
215 );
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< convert_args >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 -- {Start Of Comments}
221 --
222 -- Description:
223 -- This function is used to turn attribute parameters into the record
224 -- structure parameter g_rec_type.
225 --
226 -- Prerequisites:
227 -- This is a private function and can only be called from the ins or upd
228 -- attribute processes.
229 --
230 -- In Parameters:
231 --
232 -- Post Success:
233 -- A returning record structure will be returned.
234 --
235 -- Post Failure:
236 -- No direct error handling is required within this function. Any possible
237 -- errors within this function will be a PL/SQL value error due to conversion
238 -- of datatypes or data lengths.
239 --
240 -- Developer Implementation Notes:
241 -- None.
242 --
243 -- Access Status:
244 -- Internal Row Handler Use Only.
245 --
246 -- {End Of Comments}
247 -- ----------------------------------------------------------------------------
248 Function convert_args
249 (
250 p_cagr_grade_id in number,
251 p_cagr_grade_structure_id in number,
252 p_cagr_grade_def_id in number,
253 p_sequence in number,
254 p_object_version_number in number
255 )
256 Return g_rec_type;
257 --
258 end per_gra_shd;