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