[Home] [Help]
PACKAGE BODY: APPS.BOM_TEST_SUBSCR_PKG
Source
1 package body Bom_Test_Subscr_PKG as
2 /* $Header: BOMTSUBB.pls 120.4 2006/01/10 17:37 seradhak noship $ */
3 /***************************************************************************
4 --
5 -- Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
6 -- All rights reserved.
7 --
8 -- FILENAME
9 --
10 -- BOMTSUBB.pls
11 --
12 -- DESCRIPTION
13 --
14 -- Body of package Bom_Test_Subscr_PKG
15 --
16 -- NOTES
17 --
18 --
19 --
20 -- HISTORY
21 --
22 -- 24-Oct-2005 Selva Radhakrishnan Initial Creation
23 --
24 --
25 Bom_Test_Subscr_PKG.bom_test_subscription
26 ***************************************************************************/
27
28 FUNCTION bom_test_subscription (p_subscription_guid IN RAW,
29 p_event IN OUT NOCOPY wf_event_t)
30 RETURN VARCHAR2 IS
31 l_param_name VARCHAR2(240);
32 l_param_value VARCHAR2(2000);
33 l_event_name VARCHAR2(2000);
34 l_event_key VARCHAR2(2000);
35 l_err_text VARCHAR2(3000);
36 l_param_list WF_PARAMETER_LIST_T ;
37
38 l_debug_file_dir VARCHAR2(512);
39 l_log_file VARCHAR2(240);
40 l_log_return_status VARCHAR2(1);
41 l_errbuff VARCHAR2(3000);
42 l_error VARCHAR2(30);
43
44 BEGIN
45 SELECT VALUE INTO l_debug_file_dir FROM V$PARAMETER WHERE NAME = 'utl_file_dir';
46 IF INSTR(l_debug_file_dir,',') <> 0 THEN
47 l_debug_file_dir := SUBSTR(l_debug_file_dir, 1, INSTR(l_debug_file_dir, ',') - 1);
48 END IF;
49 l_log_file := 'BOM_TEST_SUBSCR'||'_'||TO_CHAR(SYSDATE, 'DDMONYYYY_HH24MISS')||'.err';
50
51 Error_Handler.initialize();
52 Error_Handler.Set_Debug('Y');
53 Error_Handler.Open_Debug_Session(
54 p_debug_filename => l_log_file
55 ,p_output_dir => l_debug_file_dir
56 ,x_return_status => l_log_return_status
57 ,x_error_mesg => l_errbuff
58 );
59
60 l_event_name := p_event.getEventName();
61 l_event_key := p_event.GetEventKey();
62 Error_HandLer.Write_Debug(p_debug_message => 'Event Name'|| ' = '||l_event_name );
63 Error_HandLer.Write_Debug(p_debug_message => 'Event Key '|| ' = '||l_event_key );
64
65 l_param_list := p_event.getparameterlist;
66 IF l_param_list IS NOT NULL THEN
67 FOR i IN l_param_list.FIRST..l_param_list.LAST LOOP
68 l_param_name := l_param_list(i).getname;
69 l_param_value := l_param_list(i).getvalue;
70 Error_HandLer.Write_Debug(p_debug_message => l_param_name|| ' = '||l_param_value );
71 END LOOP;
72 END IF;
73 Error_Handler.Close_Debug_Session;
74 RETURN 'SUCCESS';
75 EXCEPTION WHEN OTHERS THEN
76 l_error := SQLERRM;
77 l_err_text := 'Error : '||TO_CHAR(SQLCODE)||'---'||l_err_text;
78 Error_Handler.Add_Error_Message( p_message_text => l_err_text, p_message_type => 'E');
79 Error_Handler.Close_Debug_Session;
80 RETURN 'ERROR';
81 END bom_test_subscription;
82
83 PROCEDURE SET_BOM_EVENT_INFO
84 (
85 itemtype in varchar2,
86 itemkey in varchar2,
87 actid in number,
88 funcmode in varchar2,
89 result in out NOCOPY varchar2
90 )
91 IS
92 l_text_attr_name_tbl WF_ENGINE.NameTabTyp;
93 l_text_attr_value_tbl WF_ENGINE.TextTabTyp;
94 I PLS_INTEGER ;
95 l_event_t wf_event_t;
96 l_param_name VARCHAR2(240);
97 l_param_value VARCHAR2(1000);
98 l_param_list WF_PARAMETER_LIST_T ;
99 l_concat_param_value VARCHAR2(1000) := '';
100 BEGIN
101 if (funcmode = 'RUN') then
102
103 --
104 -- Get the Event Item Attribute
105 --
106 l_event_t := WF_ENGINE.GetItemAttrEvent(
107 itemtype => itemtype,
108 itemkey => itemkey,
109 name => 'EVENT_MESSAGE' );
110
111 l_param_list := l_event_t.getparameterlist;
112 IF l_param_list IS NOT NULL THEN
113 FOR i IN l_param_list.FIRST..l_param_list.LAST LOOP
114 l_param_name := l_param_list(i).getname;
115 l_param_value := l_param_list(i).getvalue;
116 l_concat_param_value := l_concat_param_value ||'{' ||l_param_list(i).getname ||'==>'||l_param_list(i).getvalue||'}';
117 END LOOP;
118 END IF;
119
120 -- Text Item Attributes
121 -- Using SetItemAttrTextArray():
122 I := 0 ;
123
124 -- Change Object Number
125 I := I + 1 ;
126 l_text_attr_name_tbl(I) := 'ITEMTYPE' ;
127 l_text_attr_value_tbl(I) := itemtype ;
128
129 I := I + 1 ;
130 l_text_attr_name_tbl(I) := 'ITEMKEY' ;
131 l_text_attr_value_tbl(I) := itemkey ;
132
133 I := I + 1 ;
134 l_text_attr_name_tbl(I) := 'PARAMS' ;
135 l_text_attr_value_tbl(I) := l_concat_param_value ;
136
137
138
139 WF_ENGINE.SetItemAttrTextArray
140 ( itemtype => itemtype
141 , itemkey => itemkey
142 , aname => l_text_attr_name_tbl
143 , avalue => l_text_attr_value_tbl
144 ) ;
145
146 result := 'COMPLETE';
147 return;
148 end if ; -- funcmode : RUN
149 if (funcmode = 'CANCEL') then
150
151 -- your cancel code goes here
152 null;
153
154 -- no result needed
155 result := 'COMPLETE';
156 return;
157 end if;
158 --
159 -- Other execution modes may be created in the future. Your
160 -- activity will indicate that it does not implement a mode
161 -- by returning null
162 --
163 result := '';
164 return;
165
166
167 END SET_BOM_EVENT_INFO;
168
169 END Bom_Test_Subscr_PKG;