DBA Data[Home] [Help]

PACKAGE: APPS.ASG_BASE

Source


1 PACKAGE asg_base AUTHID DEFINER AS
2 /*$Header: asgbases.pls 120.7 2011/01/10 11:20:12 saradhak ship $*/
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(100);
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   g_is_auto_sync       VARCHAR2(1);
33 
34   TYPE pub_item_rec_type IS RECORD
35                             (name VARCHAR2(30),
36                              comp_ref VARCHAR2(1),
37                              rec_count NUMBER,
38                              online_query VARCHAR2(1));
39 
40   TYPE pub_item_tbl_type IS TABLE OF pub_item_rec_type INDEX BY BINARY_INTEGER;
41 
42   g_pub_item_tbl       pub_item_tbl_type;
43   g_empty_pub_item_tbl pub_item_tbl_type; -- Should always be empty!
44 
45   -- Constants for INS,UPD,DEL
46   G_INS CONSTANT VARCHAR2(1) := 'I';
47   G_UPD CONSTANT VARCHAR2(1) := 'U';
48   G_DEL CONSTANT VARCHAR2(1) := 'D';
49 
50   -- Constant to specify complete refresh
51   G_YES CONSTANT VARCHAR2(1) := 'Y';
52   G_NO  CONSTANT VARCHAR2(1) := 'N';
53 
54 
55   -- Constants to specify client wins or server wins
56   G_CLIENT_WINS CONSTANT VARCHAR2(1) := 'C';
57   G_SERVER_WINS CONSTANT VARCHAR2(1) := 'S';
58 
59   -- Corresponds to 01 JAN 4712 BC
60   G_OLD_DATE CONSTANT DATE := to_date('1', 'J');
61 
62   -- Olite repository schema name
63   G_OLITE_SCHEMA CONSTANT VARCHAR2(30) := 'mobileadmin';
64 
65   TYPE mobile_user_list_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
66 
67   -- Device Type parameters for get_mobile_users API
68   G_ALL_DEVICES  NUMBER := 1;
69   G_POCKETPC     NUMBER := 2;
70   G_LAPTOP       NUMBER := 3;
71 
72   /* get user name for the specified resource_id */
73   FUNCTION get_user_name(p_resource_id IN NUMBER) return VARCHAR2;
74 
75   /* get resource_id for user_name */
76   FUNCTION get_resource_id(p_user_name IN VARCHAR2) return NUMBER;
77 
78   /* get user_id for user_name */
79   FUNCTION get_user_id(p_user_name IN VARCHAR2) return NUMBER;
80 
81   /* get language for user */
82   FUNCTION get_language(p_user_name IN VARCHAR2) return VARCHAR2;
83 
84   /* get application_id for user */
85   FUNCTION get_application_id(p_user_name IN VARCHAR2) return NUMBER;
86 
87   /* get mobile responsibility associated with this user */
88   FUNCTION get_resp_id(p_user_name IN VARCHAR2) return NUMBER;
89 
90   /* get resource_id */
91   FUNCTION get_resource_id return NUMBER;
92 
93   /* get user_id */
94   FUNCTION get_user_id return NUMBER;
95 
96   /* get language */
97   FUNCTION get_language return VARCHAR2;
98 
99   /* get application_id */
100   FUNCTION get_application_id return NUMBER;
101 
102   /* get mobile responsibility associated with this user */
103   FUNCTION get_resp_id return NUMBER;
104 
105   /* get user name */
106   FUNCTION get_user_name return VARCHAR2;
107 
108   /* get last successful synch date */
109   FUNCTION get_last_synch_date return DATE;
110 
111   /* Checks if the passed in publication item wll be completely refreshed   */
112   /* ands returns G_OLD_DATE. Otherwise, gets last successful synch date    */
113   FUNCTION get_last_synch_date(p_pub_item_name IN VARCHAR2) return DATE;
114 
115   /* Get current download tran id */
116   FUNCTION get_current_tranid return NUMBER;
117 
118   /* Get current download tran id - with logging Support*/
119   FUNCTION get_current_tranid(p_pub_item_name IN VARCHAR2)return NUMBER;
120 
121   /* Get last download tran id */
122   FUNCTION get_last_tranid return NUMBER;
123 
124   /* get dml type based on creation_date, update_date and */
125   /* last_synch_date. Will return either G_INS or G_UPD   */
126   FUNCTION get_dml_type(p_creation_date IN DATE) return VARCHAR2;
127 
128   /* get dml type based on update date and publication name */
129   /* For publications that will be completely refreshed the */
130   /* DML type will be insert (G_INS)                        */
131   FUNCTION get_dml_type(p_pub_item_name IN VARCHAR2,
132                         p_creation_date IN DATE) return VARCHAR2;
133 
134   /* Gets the upload tranid */
135   FUNCTION get_upload_tranid return NUMBER;
136 
137   /* returns G_YES if the publication item will be completely */
138   /* refreshed                                                */
139   FUNCTION is_first_synch(p_pub_item_name IN VARCHAR2)
140            return VARCHAR2;
141 
142   /* Initializes the global variables during synch session */
143   PROCEDURE init(p_user_name IN VARCHAR2, p_last_tranid IN NUMBER,
144                  p_curr_tranid IN NUMBER,
145                  p_last_synch_date IN DATE,
146                  p_pub_items IN pub_item_tbl_type);
147 
148   /* Initializes the global pubitem table with specified items */
149   PROCEDURE set_pub_items(p_pub_items IN pub_item_tbl_type);
150 
151   /* Sets the specified pub item for complete refresh */
152   PROCEDURE set_complete_refresh(p_pub_item_name IN VARCHAR2);
153 
154   /* Sets the upload tranid */
155   PROCEDURE set_upload_tranid(p_upload_tranid IN NUMBER);
156 
157   /* Initializes the global variables with specified values.
158      Use for debug only                                       */
159   PROCEDURE init_debug(p_user_name IN VARCHAR2, p_language IN VARCHAR2,
160                        p_resource_id IN NUMBER, p_user_id IN NUMBER,
161                        p_resp_id IN NUMBER,
162                        p_application_id IN NUMBER, p_last_synch_date IN DATE);
163 
164   /* Resets all global variables to null */
165   PROCEDURE reset_all_globals;
166 
167   /* Useful for debugging */
168   /* Logs all the session information */
169   PROCEDURE print_all_globals;
170 
171   /*get the last synch date of a user*/
172   FUNCTION get_last_synch_date(p_user_id IN NUMBER) RETURN DATE;
173 
174   /* Allow download of attachment based on size */
175   FUNCTION allow_att_download(p_row_num IN NUMBER,
176                               p_blob    IN BLOB)
177   RETURN VARCHAR2;
178 
179   /* Allow download of attachment based on size */
180   FUNCTION allow_attachment_download(p_row_num IN NUMBER,
181                                      p_blob    IN BLOB)
182   RETURN VARCHAR2;
183 
184   FUNCTION get_device_type RETURN NUMBER;
185 
186   FUNCTION get_device_type_name RETURN VARCHAR2;
187 
188   procedure detect_device_switch(p_user_name IN varchar2,
189                                  p_device_type OUT NOCOPY VARCHAR2);
190 
191   -- Returns G_YES if the user is a valid MFS user
192   FUNCTION is_mobile_user(p_user_id IN NUMBER)
193   RETURN VARCHAR2;
194 
195   -- Returns a list of all valid mobile users
196   FUNCTION get_mobile_users(p_device_type IN VARCHAR2)
197   RETURN mobile_user_list_type;
198 
199   -- Returns the appid/respid used when creating this user
200   PROCEDURE get_user_app_responsibility(p_user_id IN NUMBER,
201                                         p_app_id  OUT NOCOPY NUMBER,
202                                         p_resp_id OUT NOCOPY NUMBER);
203 
204   --Function to tell if it's a auto Sync
205   FUNCTION is_auto_sync RETURN VARCHAR2;
206 
207   --Function to tell if it's a download only Sync
208   FUNCTION is_download_only_sync (p_client_id IN VARCHAR2,
209 				  p_tran_id IN NUMBER ) RETURN VARCHAR2;
210 END asg_base;