DBA Data[Home] [Help]

PACKAGE: APPS.ASG_BASE

Source


1 PACKAGE asg_base AUTHID DEFINER AS
2 /*$Header: asgbases.pls 120.4 2006/05/08 15:51:25 rsripada noship $*/
3 
4 -- DESCRIPTION
5 --  Contains functions to retrieve information during a synch session.
6 --
7 --
8 -- HISTORY
9 --   02-sep-2005 rsripada   Multiple Responsibility Support
10 --   12-aug-2004 ssabesan   Added device switch changes ( bug 3824280 )
11 --   02-jun-2004 rsripada   Add function to download attachments
12 --   27-may-2003 ssabesan   Merged the branch line with main line
13 --   31-mar-2003 rsripada   Modify init method to pass last_synch_date
14 --   11-feb-2003 rsripada   Added get_upload_tranid, set_upload_tranid
15 --   28-jun-2002 vekrishn   Over Loaded GET_CURRENT_TRANID Api for logging
16 --   25-jun-2002 rsripada   Added Olite schema name as global constant
17 --   25-apr-2002 rsripada   Added debug logging functions
18 --   18-apr-2002 rsripada   Added functions for online queries etc.
19 --   29-mar-2002 rsripada   Created
20 
21   g_user_name          VARCHAR2(30);
22    -- Short code version ie., 'US' instead of 'American' etc.
23   g_language           VARCHAR2(4);
24   g_resource_id        NUMBER;
25   g_user_id            NUMBER;
26   g_resp_id            NUMBER;
27   g_application_id     NUMBER;
28   g_last_synch_date    DATE;
29   g_download_tranid    NUMBER;
30   g_upload_tranid      NUMBER;
31   g_last_tranid        NUMBER;
32 
33   TYPE pub_item_rec_type IS RECORD
34                             (name VARCHAR2(30),
35                              comp_ref VARCHAR2(1),
36                              rec_count NUMBER,
37                              online_query VARCHAR2(1));
38 
39   TYPE pub_item_tbl_type IS TABLE OF pub_item_rec_type INDEX BY BINARY_INTEGER;
40 
41   g_pub_item_tbl       pub_item_tbl_type;
42   g_empty_pub_item_tbl pub_item_tbl_type; -- Should always be empty!
43 
44   -- Constants for INS,UPD,DEL
45   G_INS CONSTANT VARCHAR2(1) := 'I';
46   G_UPD CONSTANT VARCHAR2(1) := 'U';
47   G_DEL CONSTANT VARCHAR2(1) := 'D';
48 
49   -- Constant to specify complete refresh
50   G_YES CONSTANT VARCHAR2(1) := 'Y';
51   G_NO  CONSTANT VARCHAR2(1) := 'N';
52 
53 
54   -- Constants to specify client wins or server wins
55   G_CLIENT_WINS CONSTANT VARCHAR2(1) := 'C';
56   G_SERVER_WINS CONSTANT VARCHAR2(1) := 'S';
57 
58   -- Corresponds to 01 JAN 4712 BC
59   G_OLD_DATE CONSTANT DATE := to_date('1', 'J');
60 
61   -- Olite repository schema name
62   G_OLITE_SCHEMA CONSTANT VARCHAR2(30) := 'mobileadmin';
63 
64   TYPE mobile_user_list_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
65 
66   -- Device Type parameters for get_mobile_users API
67   G_ALL_DEVICES  NUMBER := 1;
68   G_POCKETPC     NUMBER := 2;
69   G_LAPTOP       NUMBER := 3;
70 
71   /* get user name for the specified resource_id */
72   FUNCTION get_user_name(p_resource_id IN NUMBER) return VARCHAR2;
73 
74   /* get resource_id for user_name */
75   FUNCTION get_resource_id(p_user_name IN VARCHAR2) return NUMBER;
76 
77   /* get user_id for user_name */
78   FUNCTION get_user_id(p_user_name IN VARCHAR2) return NUMBER;
79 
80   /* get language for user */
81   FUNCTION get_language(p_user_name IN VARCHAR2) return VARCHAR2;
82 
83   /* get application_id for user */
84   FUNCTION get_application_id(p_user_name IN VARCHAR2) return NUMBER;
85 
86   /* get mobile responsibility associated with this user */
87   FUNCTION get_resp_id(p_user_name IN VARCHAR2) return NUMBER;
88 
89   /* get resource_id */
90   FUNCTION get_resource_id return NUMBER;
91 
92   /* get user_id */
93   FUNCTION get_user_id return NUMBER;
94 
95   /* get language */
96   FUNCTION get_language return VARCHAR2;
97 
98   /* get application_id */
99   FUNCTION get_application_id return NUMBER;
100 
101   /* get mobile responsibility associated with this user */
102   FUNCTION get_resp_id return NUMBER;
103 
104   /* get user name */
105   FUNCTION get_user_name return VARCHAR2;
106 
107   /* get last successful synch date */
108   FUNCTION get_last_synch_date return DATE;
109 
110   /* Checks if the passed in publication item wll be completely refreshed   */
111   /* ands returns G_OLD_DATE. Otherwise, gets last successful synch date    */
112   FUNCTION get_last_synch_date(p_pub_item_name IN VARCHAR2) return DATE;
113 
114   /* Get current download tran id */
115   FUNCTION get_current_tranid return NUMBER;
116 
117   /* Get current download tran id - with logging Support*/
118   FUNCTION get_current_tranid(p_pub_item_name IN VARCHAR2)return NUMBER;
119 
120   /* Get last download tran id */
121   FUNCTION get_last_tranid return NUMBER;
122 
123   /* get dml type based on creation_date, update_date and */
124   /* last_synch_date. Will return either G_INS or G_UPD   */
125   FUNCTION get_dml_type(p_creation_date IN DATE) return VARCHAR2;
126 
127   /* get dml type based on update date and publication name */
128   /* For publications that will be completely refreshed the */
129   /* DML type will be insert (G_INS)                        */
130   FUNCTION get_dml_type(p_pub_item_name IN VARCHAR2,
131                         p_creation_date IN DATE) return VARCHAR2;
132 
133   /* Gets the upload tranid */
134   FUNCTION get_upload_tranid return NUMBER;
135 
136   /* returns G_YES if the publication item will be completely */
137   /* refreshed                                                */
138   FUNCTION is_first_synch(p_pub_item_name IN VARCHAR2)
139            return VARCHAR2;
140 
141   /* Initializes the global variables during synch session */
142   PROCEDURE init(p_user_name IN VARCHAR2, p_last_tranid IN NUMBER,
143                  p_curr_tranid IN NUMBER,
144                  p_last_synch_date IN DATE,
145                  p_pub_items IN pub_item_tbl_type);
146 
147   /* Initializes the global pubitem table with specified items */
148   PROCEDURE set_pub_items(p_pub_items IN pub_item_tbl_type);
149 
150   /* Sets the specified pub item for complete refresh */
151   PROCEDURE set_complete_refresh(p_pub_item_name IN VARCHAR2);
152 
153   /* Sets the upload tranid */
154   PROCEDURE set_upload_tranid(p_upload_tranid IN NUMBER);
155 
156   /* Initializes the global variables with specified values.
157      Use for debug only                                       */
158   PROCEDURE init_debug(p_user_name IN VARCHAR2, p_language IN VARCHAR2,
159                        p_resource_id IN NUMBER, p_user_id IN NUMBER,
160                        p_resp_id IN NUMBER,
161                        p_application_id IN NUMBER, p_last_synch_date IN DATE);
162 
163   /* Resets all global variables to null */
164   PROCEDURE reset_all_globals;
165 
166   /* Useful for debugging */
167   /* Logs all the session information */
168   PROCEDURE print_all_globals;
169 
170   /*get the last synch date of a user*/
171   FUNCTION get_last_synch_date(p_user_id IN NUMBER) RETURN DATE;
172 
173   /* Allow download of attachment based on size */
174   FUNCTION allow_att_download(p_row_num IN NUMBER,
175                               p_blob    IN BLOB)
176   RETURN VARCHAR2;
177 
178   /* Allow download of attachment based on size */
179   FUNCTION allow_attachment_download(p_row_num IN NUMBER,
180                                      p_blob    IN BLOB)
181   RETURN VARCHAR2;
182 
183   FUNCTION get_device_type RETURN NUMBER;
184 
185   FUNCTION get_device_type_name RETURN VARCHAR2;
186 
187   procedure detect_device_switch(p_user_name IN varchar2,
188                                  p_device_type OUT NOCOPY VARCHAR2);
189 
190   -- Returns G_YES if the user is a valid MFS user
191   FUNCTION is_mobile_user(p_user_id IN NUMBER)
192   RETURN VARCHAR2;
193 
194   -- Returns a list of all valid mobile users
195   FUNCTION get_mobile_users(p_device_type IN VARCHAR2)
196   RETURN mobile_user_list_type;
197 
198   -- Returns the appid/respid used when creating this user
199   PROCEDURE get_user_app_responsibility(p_user_id IN NUMBER,
200                                         p_app_id  OUT NOCOPY NUMBER,
201                                         p_resp_id OUT NOCOPY NUMBER);
202 
203 END asg_base;