Subversion Repositories SmartDukaan

Rev

Rev 4725 | Rev 5118 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4725 Rev 4957
Line 2... Line 2...
2
 
2
 
3
import in.shop2020.catalog.dashboard.client.CatalogService;
3
import in.shop2020.catalog.dashboard.client.CatalogService;
4
import in.shop2020.catalog.dashboard.client.CatalogServiceAsync;
4
import in.shop2020.catalog.dashboard.client.CatalogServiceAsync;
5
 
5
 
6
import java.util.Date;
6
import java.util.Date;
-
 
7
import java.util.List;
7
import java.util.Map;
8
import java.util.Map;
8
import java.util.Map.Entry;
9
import java.util.Map.Entry;
9
 
10
 
10
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.user.client.Window;
12
import com.google.gwt.user.client.Window;
Line 31... Line 32...
31
    // the username-pwd pair for staging or for production.
32
    // the username-pwd pair for staging or for production.
32
    // production password is needed while updating item on production server.
33
    // production password is needed while updating item on production server.
33
    public static final int ROLE_STAGING = 0, ROLE_PRODUCTION = 1;
34
    public static final int ROLE_STAGING = 0, ROLE_PRODUCTION = 1;
34
    
35
    
35
    private static Map<Long, String> vendors, warehouses, sources;
36
    private static Map<Long, String> vendors, warehouses, sources;
-
 
37
    private static List<String> categories, brands;
36
    
38
    
37
    private static final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
39
    private static final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
38
    
40
    
39
    static {
41
    static {
40
        catalogService.getAllVendors(new AsyncCallback<Map<Long,String>>() {
42
        catalogService.getAllVendors(new AsyncCallback<Map<Long,String>>() {
Line 67... Line 69...
67
            @Override
69
            @Override
68
            public void onFailure(Throwable caught) {
70
            public void onFailure(Throwable caught) {
69
                caught.printStackTrace();
71
                caught.printStackTrace();
70
            }
72
            }
71
        });
73
        });
-
 
74
        
-
 
75
        catalogService.getAllCategories(new AsyncCallback<List<String>>() {
-
 
76
            @Override
-
 
77
            public void onSuccess(List<String> result) {
-
 
78
            	categories = result;
-
 
79
            }
-
 
80
            @Override
-
 
81
            public void onFailure(Throwable caught) {
-
 
82
                caught.printStackTrace();
-
 
83
            }
-
 
84
        });
-
 
85
        
-
 
86
        catalogService.getAllBrands(new AsyncCallback<List<String>>() {
-
 
87
            @Override
-
 
88
            public void onSuccess(List<String> result) {
-
 
89
            	brands = result;
-
 
90
            }
-
 
91
            @Override
-
 
92
            public void onFailure(Throwable caught) {
-
 
93
                caught.printStackTrace();
-
 
94
            }
-
 
95
        });
72
 
96
 
73
    }
97
    }
74
    
98
    
75
    public static Map<Long, String> getAllVendors() {
99
    public static Map<Long, String> getAllVendors() {
76
        return vendors;
100
        return vendors;
Line 82... Line 106...
82
    
106
    
83
    public static Map<Long, String> getAllWarehouses() {
107
    public static Map<Long, String> getAllWarehouses() {
84
        return warehouses;
108
        return warehouses;
85
    }
109
    }
86
    
110
    
-
 
111
    public static List<String> getAllCategories() {
-
 
112
        return categories;
-
 
113
    }
-
 
114
    
-
 
115
    public static List<String> getAllBrands() {
-
 
116
        return brands;
-
 
117
    }
-
 
118
    
87
    public static String getVendorDesc(long id) {
119
    public static String getVendorDesc(long id) {
88
        if(vendors == null) {
120
        if(vendors == null) {
89
            return null;
121
            return null;
90
        }
122
        }
91
        return vendors.get(id);
123
        return vendors.get(id);