DBA Data[Home] [Help]

PACKAGE BODY: APPS.UMX_PUB

Source


1 PACKAGE BODY UMX_PUB AS
2 /* $Header: UMXPRRSB.pls 120.5 2006/09/11 18:17:50 kching noship $ */
3 
4   -- Function         :  get_attribute_value
5   -- Type             :  Public
6   -- Pre_reqs         :  None
7   -- Description      :  Get the attribute value from the workflow.
8   -- input parameters :
9   -- @param  p_reg_request_id
10   --    Description : Registration Request ID
11   --    Required    : Yes
12   -- @param  p_attribute_name
13   --    Description : Attribute name
14   --    Required    : Yes
15   -- Output           :
16   --    Description : Attribute value
17   --
18   function get_attribute_value (
19     p_reg_request_id in UMX_REG_REQUESTS.REG_REQUEST_ID%TYPE,
20     p_attribute_name in varchar2
21   ) return varchar2 is
22 
23   l_value varchar2 (4000);
24   l_registration_data wf_event_t;
25 
26   begin
27 
28     l_value := wf_engine.GetItemAttrText (
29         itemtype        => UMX_REGISTRATION_UTIL.G_ITEM_TYPE,
30         itemkey         => p_reg_request_id,
31         aname           => p_attribute_name,
32         ignore_notfound => true);
33 
34     if (l_value is null) then
35 
36       -- Try to get the attribute value from the Event Object
37       l_registration_data :=
38         wf_engine.getitemattrevent (itemtype => UMX_REGISTRATION_UTIL.G_ITEM_TYPE,
39             itemkey  => p_reg_request_id,
40             name     => 'REGISTRATION_DATA');
41 
42       l_value := wf_event.GetValueForParameter (
43                    p_name          => p_attribute_name,
44                    p_parameterlist => l_registration_data.getParameterList);
45     end if;
46     return (l_value);
47 
48   end get_attribute_value;
49 
50   --
51   -- Procedure        :  assign_role
52   -- Type             :  Public
53   -- Pre_reqs         :  None
54   -- Description      :  This API will assign or launch wf to assign role.
55   -- Input Parameters (Mandatory):
56   -- p_registration_data : Table of record type of UMX_REGISTRATION_DATA
57   -- Output Parameters:
58   -- p_registration_data : Table of record type of UMX_REGISTRATION_DATA
59   --
60   procedure assign_role (p_registration_data in out NOCOPY UMX_REGISTRATION_PVT.UMX_REGISTRATION_DATA_TBL) IS
61   begin
62 
63     if (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) then
64       FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
65                       'fnd.plsql.UMXPRRSB.assignRole.begin', '');
66     end if;
67 
68     UMX_REGISTRATION_PVT.assign_role (p_registration_data);
69 
70     if (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) then
71       FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
72                       'fnd.plsql.UMXPRRSB.assignRole.end', '');
73     end if;
74   end assign_role;
75 
76   --
77   -- Procedure        :  updateWfAttribute
78   -- Type             :  Public
79   -- Pre_reqs         :  None
80   -- Description      :  This API can be invoked by anyone who registers a pl/sql subscription to
81   --                     UMX raised Business Events during registration. This api will update the main
82   -- 			 User Management workflow event(payload) object and also the corresponding
83   --			 workflow attribute. If p_attr_name doesnt exist in the workflow, one is created.
84   --                     This API can also be called by anyone who has a custom notification workflow
85   --			 defined, and want this name value pair to be reflected in the main workflow;
86   --			 this name value pair will be available to rest of subscriptions and workflow
87   --			 activities.
88   -- thi
89   -- Input Parameters (Mandatory):
90   -- p_event : Oracle Worflow WF_EVENT_T object type
91   -- Input params (Optional)
92   -- p_attr_name : Varchar2, name of the attribute, maps to workflow attribute name.
93   -- p_attr_value : varchar2, value of the attribute, maps to workflow attibute string value.
94 
95   -- Output Parameters:
96   -- p_event : Oracle Worflow WF_EVENT_T object type
97   --
98   procedure updateWfAttribute (p_event in out NOCOPY WF_EVENT_T,
99   			       p_attr_name in VARCHAR2 DEFAULT NULL,
100 			       p_attr_value in VARCHAR2 DEFAULT NULL) is
101   l_status varchar2(30);
102   begin
103    l_status := umx_registration_util.set_event_object (p_event => p_event,
104                                                        p_attr_name => p_attr_name,
105 						       p_attr_value => p_attr_value);
106    EXCEPTION
107    WHEN OTHERS THEN
108    RAISE;
109   end updateWfAttribute;
110   --
111   -- Procedure        :  notification_process_done
112   -- Type             :  Public
113   -- Pre_reqs         :  None
114   -- Description      :  This api will restart the sleeping main workflow.
115   procedure Notification_Process_Done (item_type    in  varchar2,
116                                        item_key     in  varchar2,
117                                        activity_id  in  number,
118                                        command      in  varchar2,
119                                        resultout    out NOCOPY varchar2) is
120   BEGIN
121 
122    UMX_NOTIFICATION_UTIL.Notification_process_done
123                                  ( item_type => item_type,
124 				   item_key  => item_key,
125 				   activity_id => activity_id,
126 				   command => command,
127 				   resultout => resultout);
128 
129    EXCEPTION
130    WHEN OTHERS THEN
131    RAISE;
132 
133   END Notification_process_done;
134 
135   --
136   -- Procedure        :  get_suggested_username
137   -- Type             :  Public
138   -- Pre_reqs         :  None
139   -- Description      :  This API will return the suggested user name for a person.
140   --                     The user name will be generated via the
141   --                     oracle.apps.fnd.umx.username.generate Business Event
142   --                     which will be raised by this API.  The event could
143   --                     return a null value as the user name if the user name
144   --                     could not be generated.
145   -- Input Parameters :
146   -- @param     p_person_party_id
147   --    Description:  Person Party ID of the person who to generate
148   --                  a username for.
149   --    Required   :  N
150   -- Output Parameters :
151   --   x_suggested_username: Username generated by the Username Policy. May return null.
152   --
153   --
154   procedure get_suggested_username (p_person_party_id    in HZ_PARTIES.PARTY_ID%TYPE default null,
155                                     x_suggested_username out nocopy FND_USER.USER_NAME%TYPE) is
156   begin
157 
158     if (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) then
159       FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
160                       'fnd.plsql.UMXPRRSB.get_suggested_username.begin',
161                       'p_person_party_id: ' || p_person_party_id);
162     end if;
163 
164     UMX_USERNAME_POLICY_PVT.get_suggested_username (p_person_party_id    => p_person_party_id,
165                                                     x_suggested_username => x_suggested_username);
166 
167     if (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) then
168       FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
169                       'fnd.plsql.UMXPRRSB.get_suggested_username.end',
170                       'x_suggested_username: ' || x_suggested_username);
171     end if;
172 
173   end get_suggested_username;
174 
175   --
176   -- Procedure        :  get_username_policy_desc
177   -- Type             :  Public
178   -- Pre_reqs         :  None
179   -- Description      :  This API will return the description of the user name
180   --                     policy.  The return parameters / user name policy is
181   --                     based on the UMX: User Name Policy (UMX_USERNAME_POLICY)
182   --                     profile option, which points to a LOOKUP TYPE that
183   --                     should include the following:
184   --
185   --                       LOOKUP CODES: DESCRIPTION, PROMPT, HINT
186   --
187   --                     with the appropriate LOOKUP MEANING defined. Example:
188   --
189   --                       LOOKUP TYPE: UMX_USERNAME_POLICY:EMAIL
190   --
191   --  LOOKUP CODE    MEANING                     DESCRIPTION
192   --  -----------    --------------------------  -------------------------------
193   --  PROMPT         User Name                   Prompt of the user name text
194   --                                             input field.
195   --
196   --  DESCRIPTION    User Names must be based    Description of the policy
197   --                 on Email Address
198   --
199   --  HINT           example: [email protected]  Example of what the username should
200   --                                             look like.
201   --
202   -- Input Parameters :
203   -- Output Parameters :
204   -- x_policy_code:      User Name Policy code. Preseeded policies are:
205   --
206   --                     Code: UMX_USERNAME_POLICY:EMAIL
207   --                     Meaning: User name should be defined as Email Address.
208   --                              Product teams may choose to hide the email
209   --                              field in any account creation / registration
210   --                              UI's as long as the entered username (email)
211   --                              is copied into the fnd_user.email_address field
212   --                              as well.
213   --
214   --                     Code: UMX_USERNAME_POLICY:NONE
215   --                     Meaning: No username policy / format defined, freetext
216   --
217   --                     Code: Anything else, this would be a custom policy defined
218   --                           at a client site.
219   --
220   -- x_description:      User Name Policy description. May be null. For example:
221   --
222   --                       "User Names must be based on <b>Email Address</b>".
223   --                       The description can be displayed as a quick tip in
224   --                       the user account creation/registration page.
225   --
226   -- x_prompt:           Prompt of the User Name field. Defaults to "User Name" if
227   --                     none is defined in the policy.
228   --
229   -- x_hint:             An example of the user name format. May be null. For
230   --                     example:
231   --
232   --                       "(example: [email protected])"
233   --
234   --                     The hint can be displayed as an inline hint below the
235   --                     User Name field in any user account creation/registration
236   --                     page.
237   --
238   --
239   procedure get_username_policy_desc
240                 (x_policy_code out nocopy FND_LOOKUP_TYPES.LOOKUP_TYPE%TYPE,
241                  x_description out nocopy FND_LOOKUP_VALUES.MEANING%TYPE,
242                  x_prompt      out nocopy FND_LOOKUP_VALUES.MEANING%TYPE,
243                  x_hint        out nocopy FND_LOOKUP_VALUES.MEANING%TYPE) is
244 
245   begin
246 
247     if (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) then
248       FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
249                       'fnd.plsql.UMXPRRSB.get_username_policy_desc.begin', '');
250     end if;
251 
252     UMX_USERNAME_POLICY_PVT.get_username_policy_desc (x_policy_code => x_policy_code,
253                                                       x_description => x_description,
254                                                       x_prompt      => x_prompt,
255                                                       x_hint        => x_hint);
256 
257 
258     if (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) then
259       FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
260                       'fnd.plsql.UMXPRRSB.get_username_policy_desc.end',
261                       'x_policy_code: ' || x_policy_code ||
262                       ' | x_description: ' || x_description ||
263                       ' | x_prompt: '      || x_prompt ||
264                       ' | x_hint: '        || x_hint);
265     end if;
266 
267   end get_username_policy_desc;
268 
269 END UMX_PUB;