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