Subversion Repositories SmartDukaan

Rev

Rev 2068 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2066 ankur.sing 1
package in.shop2020.catalog.dashboard.shared;
2
 
3
import in.shop2020.catalog.dashboard.client.CatalogService;
4
import in.shop2020.catalog.dashboard.client.CatalogServiceAsync;
5
 
6
import java.util.Map;
7
 
8
import com.google.gwt.core.client.GWT;
9
import com.google.gwt.user.client.rpc.AsyncCallback;
10
 
11
public class Utils {
12
 
13
    private static Map<Long, String> vendors, warehouses;
14
    private static final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
15
    static {
16
        catalogService.getAllVendors(new AsyncCallback<Map<Long,String>>() {
17
            @Override
18
            public void onSuccess(Map<Long, String> result) {
19
                vendors = result;
20
            }
21
            @Override
22
            public void onFailure(Throwable caught) {
23
            }
24
        });
25
 
26
        catalogService.getAllWarehouses(new AsyncCallback<Map<Long,String>>() {
27
            @Override
28
            public void onSuccess(Map<Long, String> result) {
29
                warehouses = result;
30
            }
31
            @Override
32
            public void onFailure(Throwable caught) {
33
            }
34
        });
35
    }
36
 
37
    public static String getVendorDesc(long id) {
38
        if(vendors == null) {
39
            return null;
40
        }
41
        return vendors.get(id);
42
    }
43
 
44
    public static String getWarehouseDesc(long id) {
45
        if(warehouses == null) {
46
            return null;
47
        }
48
        return warehouses.get(id);
49
    }
50
}