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