| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.utils;
|
1 |
package in.shop2020.serving.utils;
|
| 2 |
|
2 |
|
| 3 |
import java.io.ByteArrayInputStream;
|
3 |
import java.io.ByteArrayInputStream;
|
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.File;
|
- |
|
| 6 |
import java.io.FileInputStream;
|
- |
|
| 7 |
import java.io.FileOutputStream;
|
- |
|
| 8 |
import java.io.ObjectInputStream;
|
5 |
import java.io.ObjectInputStream;
|
| 9 |
import java.io.ObjectOutputStream;
|
6 |
import java.io.ObjectOutputStream;
|
| 10 |
import java.util.ArrayList;
|
- |
|
| 11 |
import java.util.Calendar;
|
- |
|
| 12 |
import java.util.Date;
|
- |
|
| 13 |
import java.util.HashMap;
|
- |
|
| 14 |
import java.util.Iterator;
|
- |
|
| 15 |
import java.util.List;
|
7 |
import java.util.List;
|
| 16 |
import java.util.Map;
|
- |
|
| 17 |
import java.util.Map.Entry;
|
- |
|
| 18 |
|
8 |
|
| 19 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
- |
|
| 20 |
import in.shop2020.model.v1.catalog.Item;
|
9 |
import in.shop2020.model.v1.catalog.Item;
|
| 21 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
10 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 22 |
import in.shop2020.model.v1.user.Cart;
|
11 |
import in.shop2020.model.v1.user.Cart;
|
| 23 |
|
12 |
|
| 24 |
import in.shop2020.model.v1.user.Line;
|
13 |
import in.shop2020.model.v1.user.Line;
|
| 25 |
import in.shop2020.model.v1.user.LineStatus;
|
- |
|
| 26 |
import in.shop2020.model.v1.user.Sex;
|
14 |
import in.shop2020.model.v1.user.Sex;
|
| 27 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
15 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
| 28 |
import in.shop2020.model.v1.user.Address;
|
- |
|
| 29 |
import in.shop2020.model.v1.user.User;
|
16 |
import in.shop2020.model.v1.user.User;
|
| 30 |
import in.shop2020.model.v1.user.UserContextException;
|
17 |
import in.shop2020.model.v1.user.UserContextException;
|
| 31 |
import in.shop2020.model.v1.widgets.WidgetException;
|
18 |
import in.shop2020.model.v1.widgets.WidgetException;
|
| 32 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
19 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
| 33 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
20 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 34 |
import in.shop2020.thrift.clients.WidgetServiceClient;
|
- |
|
| 35 |
|
21 |
|
| 36 |
import org.apache.thrift.TException;
|
22 |
import org.apache.thrift.TException;
|
| 37 |
|
23 |
|
| 38 |
public class Utils {
|
24 |
public class Utils {
|
| - |
|
25 |
//FIXME: Read this path from the config server
|
| 39 |
public static final String EXPORT_ENTITIES_PATH = "/var/lib/tomcat6/webapps/export/html/entities/";
|
26 |
public static final String EXPORT_ENTITIES_PATH = "/var/lib/tomcat6/webapps/export/html/entities/";
|
| 40 |
/*
|
27 |
/*
|
| 41 |
private static UserContextServiceClient userContextServiceClient;
|
28 |
private static UserContextServiceClient userContextServiceClient;
|
| 42 |
private static ShoppingCartClient shoppingCartClient;
|
29 |
private static ShoppingCartClient shoppingCartClient;
|
| 43 |
private static CatalogServiceClient catalogServiceClient;
|
30 |
private static CatalogServiceClient catalogServiceClient;
|
| Line 411... |
Line 398... |
| 411 |
in.close();
|
398 |
in.close();
|
| 412 |
}
|
399 |
}
|
| 413 |
}
|
400 |
}
|
| 414 |
return obj;
|
401 |
return obj;
|
| 415 |
}
|
402 |
}
|
| 416 |
/*
|
403 |
|
| 417 |
public static void main(String args[]) throws Exception{
|
404 |
// public static void main(String args[]) throws Exception{
|
| 418 |
// to store categories
|
405 |
// // to store categories
|
| 419 |
Map<Long, Category> categories = new HashMap<Long, Category>();
|
406 |
// Map<Long, Category> categories = new HashMap<Long, Category>();
|
| 420 |
Map<Long, in.shop2020.metamodel.definitions.Category> cmsCategories = Catalog.getInstance().getDefinitionsContainer().getCategories();
|
407 |
// Map<Long, in.shop2020.metamodel.definitions.Category> cmsCategories = Catalog.getInstance().getDefinitionsContainer().getCategories();
|
| 421 |
for(in.shop2020.metamodel.definitions.Category cmsCategory: cmsCategories.values()){
|
408 |
// for(in.shop2020.metamodel.definitions.Category cmsCategory: cmsCategories.values()){
|
| 422 |
Category category = new Category(cmsCategory.getID());
|
409 |
// Category category = new Category(cmsCategory.getID());
|
| 423 |
category.setLabel(cmsCategory.getLabel());
|
410 |
// category.setLabel(cmsCategory.getLabel());
|
| 424 |
if(cmsCategory.getParentCategory()!=null){
|
411 |
// if(cmsCategory.getParentCategory()!=null){
|
| 425 |
category.setParentCategoryId(cmsCategory.getParentCategory().getID());
|
412 |
// category.setParentCategoryId(cmsCategory.getParentCategory().getID());
|
| 426 |
}
|
413 |
// }
|
| 427 |
if(cmsCategory.getChildrenCategory()!=null){
|
414 |
// if(cmsCategory.getChildrenCategory()!=null){
|
| 428 |
for(in.shop2020.metamodel.definitions.Category childCategory: cmsCategory.getChildrenCategory()){
|
415 |
// for(in.shop2020.metamodel.definitions.Category childCategory: cmsCategory.getChildrenCategory()){
|
| 429 |
category.addChild(childCategory.getID());
|
416 |
// category.addChild(childCategory.getID());
|
| 430 |
}
|
417 |
// }
|
| 431 |
}
|
418 |
// }
|
| 432 |
categories.put(cmsCategory.getID(), category);
|
419 |
// categories.put(cmsCategory.getID(), category);
|
| 433 |
}
|
420 |
// }
|
| 434 |
Utils.storeCategories(categories);
|
421 |
// Utils.storeCategories(categories);
|
| 435 |
// to get categories
|
422 |
// // to get categories
|
| - |
|
423 |
// //Map<Long, Category>
|
| 436 |
Map<Long, Category> categories = (Map<Long, Category>)Utils.getCategories();
|
424 |
// categories = (Map<Long, Category>)Utils.getCategories();
|
| 437 |
System.out.println("hello");
|
425 |
// System.out.println("hello");
|
| 438 |
}
|
426 |
// }
|
| 439 |
*/
|
427 |
|
| 440 |
}
|
428 |
}
|
| 441 |
|
429 |
|
| 442 |
|
430 |
|