DBA Data[Home] [Help]

PACKAGE: APPS.FND_FUNCTION

Source


1 package FND_FUNCTION AUTHID CURRENT_USER as
2 /* $Header: AFSCFNSS.pls 120.4.12020000.2 2013/02/17 16:04:40 jvalenti ship $ */
3 
4 --
5 -- This boolean is used for performance to prevent the need to call the
6 -- FAST_COMPILE procedure repeatedly.
7 -- Other packages that reference FND_COMPILED_MENU_FUNCTIONS should
8 -- call it like this in their package initialization block:
9 --
10 --   if (FND_FUNCTION.G_ALREADY_FAST_COMPILED <> 'T') then
11 --     FND_FUNCTION.FAST_COMPILE;
12 --   end if;
13 --
14 G_ALREADY_FAST_COMPILED varchar2(1) := 'F';
15 
16 --
17 -- TEST
18 --   Test if function is accessible under current responsibility.
19 --   Only checks static function security, and global object type
20 --   grants from data security.  Because this routine does not
21 --   take the object id and instance pks, it cannot test for
22 --   most data security grants, and therefore it should not
23 --   be used if the object id and/or instance pks are known.
24 --   This is here for cases where performance is critical,
25 --   and for backwards compatibility, but in general new code
26 --   should use TEST_INSTANCE instead if acting on a particular
27 --   object instance (database row).
28 -- IN
29 --   function_name - function to test
30 --   TEST_MAINT_AVAILIBILTY-   'Y' (default) means check if available for
31 --                             current value of profile APPS_MAINTENANCE_MODE
32 --                             'N' means the caller is checking so it's
33 --                             unnecessary to check.
34 -- RETURNS
35 --  TRUE if function is accessible
36 --
37 function TEST(function_name in varchar2,
38               TEST_MAINT_AVAILABILITY in varchar2 default NULL)
39     return boolean;
40 
41 
42 --
43 -- TEST_ID
44 --   Test if function id is accessible under current responsibility.
45 --   See comments for TEST() for more information on functionality.
46 -- IN
47 --   function_id - function id to test
48 -- RETURNS
49 --  TRUE if function is accessible
50 --
51 function TEST_ID(function_id in number) return boolean;
52 
53 
54 
55 
56 --
57 -- TEST_INSTANCE
58 --   Test if function is accessible under current resp and user, for
59 --   the object instance (database row) which is the current instance.
60 --   This actually checks both the function security
61 --   and data security system as described at the oracle internal link:
62 --       http://www-apps.us.oracle.com/atg/plans/r115x/datasec.txt
63 --
64 -- IN
65 --   function_name - function to test
66 --
67 --   Generally the user should pass the object_name and whichever
68 --   of the instance_pkX_values apply to that object.
69 --   If the user does not pass the object_name param, and
70 --     does not pass instance_pkX_values then only global
71 --     object type grants will get picked up from fnd_grants.
72 --   Passing object_name but not instance_pkXvalues is not supported.
73 --
74 --   object_name and pk values- object and primary key values of the current
75 --      object.  If you pass the object_name, you must pass values for
76 --      the primary key value(s).
77 --   user_name- Normally the caller leaves this blank so it will test
78 --              with the current FND user.  But folks who populate their
79 --              grants with special "compound" usernames might need
80 --              to pass the grantee_key (user_name) of the current user.
81 -- RETURNS
82 --  TRUE if function is accessible
83 --  FALSE if function is not accessible or if there was an error.
84 --
85 function TEST_INSTANCE(function_name in varchar2,
86                        object_name          IN  VARCHAR2 DEFAULT NULL,
87                        instance_pk1_value   IN  VARCHAR2 DEFAULT NULL,
88                        instance_pk2_value   IN  VARCHAR2 DEFAULT NULL,
89                        instance_pk3_value   IN  VARCHAR2 DEFAULT NULL,
90                        instance_pk4_value   IN  VARCHAR2 DEFAULT NULL,
91                        instance_pk5_value   IN  VARCHAR2 DEFAULT NULL,
92                        user_name            IN  VARCHAR2 DEFAULT NULL
93 ) return boolean;
94 
95 
96 --
97 -- TEST_ID_SLOW
98 --   AOL INTERNAL USE ONLY!
99 --   Does the same thing as TEST_ID, but never uses the compiled table.
100 --   The only reason this is exposed is for testing the security system;
101 --   All real code should call TEST_ID.
102 --
103 function TEST_ID_SLOW(function_id in number) return boolean;
104 
105 --
106 -- IS_FUNCTION_ON_MENU
107 --   Test if function is on a particular menu.
108 --   This routine was designed to be called from the SQL statements
109 --   in data security, as a was of replacing the menu "connect by".
110 --
111 --   Since this routine ignores the current context, and ignores
112 --   exclusions, it should not be used to test whether a particular
113 --   function is available in the current context.
114 --
115 --   The algorithm is that it looks to see if the menu is marked as
116 --   uncompiled.  If so, it uses the normal search.  If not, it looks
117 --   at the compiled value.
118 -- IN
119 --   p_menu_id     - menu to check
120 --   p_function_id - function to look for
121 --   p_check_grant_flag - if TRUE, then we won't return TRUE unless
122 --                        GRANT_FLAG = 'Y'.  Generally pass FALSE
123 --                        for Data Security and TRUE for Func Sec.
124 --
125 -- RETURNS
126 --  TRUE if function is on menu
127 --  FALSE if function is not on menu
128 --
129 function IS_FUNCTION_ON_MENU(p_menu_id     IN NUMBER,
130                              p_function_id IN NUMBER,
131                              p_check_grant_flag IN BOOLEAN default FALSE)
132 return boolean;
133 
134 --
135 -- COMPILE
136 --   This routine is called by the concurrent request FNDSCMPI.
137 --   It writes messages out to the log file so it only is for
138 --   conc requests, not forms or other db code.
139 --
140 --  everything is a flag.  'Y' calls COMPILE_ALL_FROM_SCRATCH
141 --                         'N' calls COMPILE_ALL_MARKED
142 procedure COMPILE( errbuf out NOCOPY varchar2,
143                               retcode  out NOCOPY varchar2,
144                               everything in varchar2 /* 'Y' or 'N'*/);
145 
146 --
147 -- COMPILE_CHANGES
148 --   This routine is called by the DBMS_SCHEDULER method of
149 --   asynchronous execution.
150 --   It writes messages out to the log file so it only is for
151 --   conc requests, not forms or other db code.
152 --
153 procedure COMPILE_CHANGES;
154 
155 --
156 -- COMPILE_ALL_MARKED
157 --   This is the normal routine used to compile menus.  This will
158 --   only compile the menus that need compilation.  It should be much
159 --   quicker than COMPILE_ALL_FROM_SCRATCH
160 --
161 --  compile_missing- Normally let this default to 'Y', which means
162 --     that this will check for menus that are completely missing
163 --     (neither marked nor compiled), and will compile those.
164 --     Passing 'N' will only compile marked menus but will not detect
165 --     lack of mark in any way.  That should only be done when performance
166 --     is very important; Passing 'N' reduces time to ~.01 second when there
167 --     is nothing to compile, versus about .14 second when passing 'Y'.
168 --     If there are menus to compile, time can be significantly longer,
169 --     up to several minutes if all 40,000 or so rows need recompilation.
170 --  RETURNS: number of rows processed.
171 --
172 function COMPILE_ALL_MARKED(compile_missing in VARCHAR2 default 'Y')
173  return NUMBER;
174 
175 
176 -- FAST_COMPILE-
177 --
178 -- Recompiles all the marked menus if and only if they haven't yet
179 -- been already compiled in this session.
180 --
181 -- Other packages that reference FND_COMPILED_MENU_FUNCTIONS should
182 -- call it like this in their package initialization block:
183 --
184 --   if (FND_FUNCTION.G_ALREADY_FAST_COMPILED <> 'T') then
185 --     FND_FUNCTION.FAST_COMPILE;
186 --   end if;
187 --
188 -- Administrators can also call it from SQL*Plus in order to compile
189 -- the FND_COMPILED_MENU_FUNCTIONS table, like this:
190 --
191 -- execute FND_FUNCTION.FAST_COMPILE;
192 --
193 -- That is the preferred way of doing a manual compile.
194 --
195 procedure FAST_COMPILE;
196 
197 
198 --
199 -- COMPILE_ALL_FROM_SCRATCH
200 --   This is the compilation routine that is only called when you
201 --   are unsure of the data integrity of your system and want to
202 --   recompile from scratch. It can take a long time (several minutes
203 --   or more) and during that time, some of the compiled menu data
204 --   will not be available, which is why it is usually suggested
205 --   to use FAST_COMPILE (normally) or COMPILE_ALL_MARKED('Y') (for
206 --   more thoroughness) instead.
207 --  RETURNS: number of rows processed.
208 function COMPILE_ALL_FROM_SCRATCH return NUMBER;
209 
210 --
211 -- COMPILE_MENU_MARKED
212 --   AOL INTERNAL USE ONLY!
213 --   Compile a particular menu and its kids, as marked.
214 --   Note that calling this on a changed menu will _not_ recompile
215 --   everything that includes this menu.  This should probably never
216 --   be called by outside callers and is mostly an "internal only" call.
217 --   Argument P_FORCE='Y' means compile even if not marked.
218 --   Default for P_FORCE is NULL which means 'N'
219 --  RETURNS: number of rows processed.
220 function COMPILE_MENU_MARKED(p_menu_id NUMBER,
221                       p_force varchar2 default NULL /* NULL means 'N'*/)
222     return NUMBER;
223 
224 --
225 -- ADD_QUEUED_MARKS
226 --   Adds the marks that were queued with QUEUE_MARK to the compiled
227 --   table.  This does not compile but rather indicates the need for
228 --   compilation.
229 procedure ADD_QUEUED_MARKS;
230 
231 --
232 -- QUEUE_MARK
233 --   Adds a mark to a list that will later be applied with QUEUED_MARK
234 --   This is not normally used; it is a hack for db triggers that don't
235 --   allow applying a mark on the row triggers, because that would need
236 --   to read the menu_entry table that is changing.
237 procedure QUEUE_MARK(p_menu_id in number);
238 
239 --
240 -- MARK_MENU
241 --   This is a public API that needs to be called whenever a menu or
242 --   especially menu entry has undergone a change.  This marks it
243 --   so it will be recompiled next time.  This is generally called
244 --   by the database triggers.
245 --
246 procedure MARK_MENU(p_menu_id NUMBER);
247 
248 --
249 -- MARK_ALL
250 --   Marks all the menus as needing recompilation.  Rarely used.
251 procedure MARK_ALL;
252 
253 
254 -- AVAILABILITY - This function compares the MAINTENANCE_MODE_SUPPORT
255 --                of a particular function to the APPS_MAINTENANCE_MODE
256 --                profile value and determines whether the function is
257 --                available during that maintenance phase.
258 --                This does not check function security or data security
259 --                so it is very rarely used.
260 --
261 -- in: MAINTENANCE_MODE_SUPPORT- the value from the database column
262 --
263 -- out: 'Y'= available, 'N'= not available
264 --
265 function AVAILABILITY(MAINTENANCE_MODE_SUPPORT in varchar2) return varchar2;
266 
267 --
268 -- Function get_function_id
269 --      returns the function id for a function name.
270 -- in: p_function_name- the developer function name to look up
271 -- returns: the function id, or NULL if it can't be found.
272 ------------------------------
273 Function get_function_id(p_function_name in varchar2
274                        ) return number;
275 
276 -- COMPILE_MENU
277 --
278 -- Called as a Concurrent Program to compile menu when entries are added
279 --
280 --
281 procedure COMPILE_MENU(errbuf out NOCOPY varchar2, retcode out NOCOPY number, p_menu_id in number, p_force in varchar2);
282 end FND_FUNCTION;