| Line 15... |
Line 15... |
| 15 |
import in.shop2020.model.v1.user.ItemCouponDiscount;
|
15 |
import in.shop2020.model.v1.user.ItemCouponDiscount;
|
| 16 |
import in.shop2020.thrift.clients.CatalogClient;
|
16 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 17 |
import in.shop2020.thrift.clients.LogisticsClient;
|
17 |
import in.shop2020.thrift.clients.LogisticsClient;
|
| 18 |
import in.shop2020.thrift.clients.PromotionClient;
|
18 |
import in.shop2020.thrift.clients.PromotionClient;
|
| 19 |
import in.shop2020.utils.ConfigClientKeys;
|
19 |
import in.shop2020.utils.ConfigClientKeys;
|
| - |
|
20 |
import in.shop2020.utils.GmailUtils;
|
| 20 |
|
21 |
|
| 21 |
import java.io.File;
|
22 |
import java.io.File;
|
| 22 |
import java.io.FileInputStream;
|
23 |
import java.io.FileInputStream;
|
| 23 |
import java.io.FileNotFoundException;
|
24 |
import java.io.FileNotFoundException;
|
| 24 |
import java.io.FileReader;
|
25 |
import java.io.FileReader;
|
| Line 27... |
Line 28... |
| 27 |
import java.nio.MappedByteBuffer;
|
28 |
import java.nio.MappedByteBuffer;
|
| 28 |
import java.nio.channels.FileChannel;
|
29 |
import java.nio.channels.FileChannel;
|
| 29 |
import java.nio.charset.Charset;
|
30 |
import java.nio.charset.Charset;
|
| 30 |
import java.util.ArrayList;
|
31 |
import java.util.ArrayList;
|
| 31 |
import java.util.Arrays;
|
32 |
import java.util.Arrays;
|
| - |
|
33 |
import java.util.Calendar;
|
| 32 |
import java.util.HashMap;
|
34 |
import java.util.HashMap;
|
| 33 |
import java.util.List;
|
35 |
import java.util.List;
|
| 34 |
import java.util.Map;
|
36 |
import java.util.Map;
|
| 35 |
|
37 |
|
| - |
|
38 |
import javax.mail.MessagingException;
|
| 36 |
import javax.xml.transform.Result;
|
39 |
import javax.xml.transform.Result;
|
| 37 |
import javax.xml.transform.Source;
|
40 |
import javax.xml.transform.Source;
|
| 38 |
import javax.xml.transform.Transformer;
|
41 |
import javax.xml.transform.Transformer;
|
| 39 |
import javax.xml.transform.TransformerConfigurationException;
|
42 |
import javax.xml.transform.TransformerConfigurationException;
|
| 40 |
import javax.xml.transform.TransformerException;
|
43 |
import javax.xml.transform.TransformerException;
|
| Line 719... |
Line 722... |
| 719 |
// Write it to file
|
722 |
// Write it to file
|
| 720 |
String productXMLFilename = Utils.EXPORT_PARTNERS_CONTENT_PATH + "advertismentapi.xml";
|
723 |
String productXMLFilename = Utils.EXPORT_PARTNERS_CONTENT_PATH + "advertismentapi.xml";
|
| 721 |
DBUtils.store(productDataXML, productXMLFilename);
|
724 |
DBUtils.store(productDataXML, productXMLFilename);
|
| 722 |
}
|
725 |
}
|
| 723 |
|
726 |
|
| 724 |
public static void main(String[] args) throws Exception {
|
727 |
public static void main(String[] args) {
|
| - |
|
728 |
try {
|
| 725 |
CatalogClient cl = new CatalogClient();
|
729 |
CatalogClient cl = new CatalogClient();
|
| 726 |
in.shop2020.model.v1.catalog.CatalogService.Client client = cl.getClient();
|
730 |
in.shop2020.model.v1.catalog.CatalogService.Client client = cl.getClient();
|
| 727 |
List<Item> items = client.getAllItemsByStatus(status.ACTIVE);
|
731 |
List<Item> items = client.getAllItemsByStatus(status.ACTIVE);
|
| 728 |
items.addAll(client.getAllItemsByStatus(status.PAUSED));
|
732 |
items.addAll(client.getAllItemsByStatus(status.PAUSED));
|
| 729 |
ProductListGenerator generator = new ProductListGenerator(items);
|
733 |
ProductListGenerator generator = new ProductListGenerator(items);
|
| Line 740... |
Line 744... |
| 740 |
|
744 |
|
| 741 |
log.info("Before product camera xml.");
|
745 |
log.info("Before product camera xml.");
|
| 742 |
generator.generateCamerasXML();
|
746 |
generator.generateCamerasXML();
|
| 743 |
|
747 |
|
| 744 |
log.info("Before product display ads.");
|
748 |
log.info("Before product display ads.");
|
| - |
|
749 |
} catch (Exception ex){
|
| - |
|
750 |
String logfile = "/tmp/content-from-cms.log";
|
| - |
|
751 |
GmailUtils gm = new GmailUtils();
|
| - |
|
752 |
String[] sendTo = { "rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "amit.gupta@shop2020.in" };
|
| - |
|
753 |
|
| - |
|
754 |
try {
|
| - |
|
755 |
gm.sendSSLMessage(sendTo, "Partners feed generation failed", ""
|
| - |
|
756 |
+ Calendar.getInstance().getTime().toString(),
|
| - |
|
757 |
"build@shop2020.in", "cafe@nes", logfile);
|
| - |
|
758 |
} catch (MessagingException e) {
|
| - |
|
759 |
log.error("Could not send status mail", e);
|
| - |
|
760 |
}
|
| - |
|
761 |
}
|
| 745 |
//generator.generateProductXMLForDisplayAds();
|
762 |
//generator.generateProductXMLForDisplayAds();
|
| 746 |
}
|
763 |
}
|
| 747 |
|
764 |
|
| 748 |
private String readFile(String path) throws IOException {
|
765 |
private String readFile(String path) throws IOException {
|
| 749 |
FileInputStream stream = new FileInputStream(new File(path));
|
766 |
FileInputStream stream = new FileInputStream(new File(path));
|