| Line 39... |
Line 39... |
| 39 |
import java.io.InputStream;
|
39 |
import java.io.InputStream;
|
| 40 |
import java.io.InputStreamReader;
|
40 |
import java.io.InputStreamReader;
|
| 41 |
import java.io.OutputStream;
|
41 |
import java.io.OutputStream;
|
| 42 |
import java.io.OutputStreamWriter;
|
42 |
import java.io.OutputStreamWriter;
|
| 43 |
import java.io.StringWriter;
|
43 |
import java.io.StringWriter;
|
| - |
|
44 |
import java.net.URLEncoder;
|
| 44 |
import java.text.DecimalFormat;
|
45 |
import java.text.DecimalFormat;
|
| 45 |
import java.util.ArrayList;
|
46 |
import java.util.ArrayList;
|
| 46 |
import java.util.Collection;
|
47 |
import java.util.Collection;
|
| 47 |
import java.util.Date;
|
48 |
import java.util.Date;
|
| 48 |
import java.util.HashMap;
|
49 |
import java.util.HashMap;
|
| Line 193... |
Line 194... |
| 193 |
// This URL is used to ensure that images such as icon and thumbnail for
|
194 |
// This URL is used to ensure that images such as icon and thumbnail for
|
| 194 |
// a particular entity are always downloaded from the same location.
|
195 |
// a particular entity are always downloaded from the same location.
|
| 195 |
String staticurl = "http://static" + entity.getID()%3 + "." + domain;
|
196 |
String staticurl = "http://static" + entity.getID()%3 + "." + domain;
|
| 196 |
|
197 |
|
| 197 |
templateFile= Utils.VTL_SRC_PATH + "product_summary.vm";
|
198 |
templateFile= Utils.VTL_SRC_PATH + "product_summary.vm";
|
| 198 |
getProductSummaryHtml(expEntity, items, templateFile, exportPath);
|
199 |
getProductSummaryHtml(expEntity, items, templateFile, exportPath, domain);
|
| 199 |
|
200 |
|
| 200 |
templateFile= Utils.VTL_SRC_PATH + "entity_snippet_for_widget.vm";
|
201 |
templateFile= Utils.VTL_SRC_PATH + "entity_snippet_for_widget.vm";
|
| 201 |
getEntityWidgetSnippetHtml(expEntity, items, templateFile, staticurl, exportPath);
|
202 |
getEntityWidgetSnippetHtml(expEntity, items, templateFile, staticurl, exportPath);
|
| 202 |
|
203 |
|
| 203 |
templateFile= Utils.VTL_SRC_PATH + "entity_snippet_for_homepage.vm";
|
204 |
templateFile= Utils.VTL_SRC_PATH + "entity_snippet_for_homepage.vm";
|
| Line 583... |
Line 584... |
| 583 |
writer.close();
|
584 |
writer.close();
|
| 584 |
Utils.info("Export Complete!");
|
585 |
Utils.info("Export Complete!");
|
| 585 |
|
586 |
|
| 586 |
}
|
587 |
}
|
| 587 |
|
588 |
|
| 588 |
public void getProductSummaryHtml(ExpandedEntity expEntity, List<Item> items, String templateFile, String exportPath) {
|
589 |
public void getProductSummaryHtml(ExpandedEntity expEntity, List<Item> items, String templateFile, String exportPath, String domain) {
|
| 589 |
long catalogId = expEntity.getID();
|
590 |
long catalogId = expEntity.getID();
|
| 590 |
try {
|
591 |
try {
|
| 591 |
List<Map<String, String>> itemDetails = new ArrayList<Map<String,String>>();
|
592 |
List<Map<String, String>> itemDetails = new ArrayList<Map<String,String>>();
|
| 592 |
for(Item item: items){
|
593 |
for(Item item: items){
|
| 593 |
Map<String, String> itemDetail = new HashMap<String, String>();
|
594 |
Map<String, String> itemDetail = new HashMap<String, String>();
|
| Line 635... |
Line 636... |
| 635 |
Map<String,String> params = new HashMap<String, String>();
|
636 |
Map<String,String> params = new HashMap<String, String>();
|
| 636 |
params.put("TITLE", title);
|
637 |
params.put("TITLE", title);
|
| 637 |
params.put("CATEGORY_ID", ((int)categoryId)+"");
|
638 |
params.put("CATEGORY_ID", ((int)categoryId)+"");
|
| 638 |
params.put("CATEGORY_NAME", categoryName);
|
639 |
params.put("CATEGORY_NAME", categoryName);
|
| 639 |
params.put("CATEGORY_URL", categoryName.replaceAll(" ", "-").toLowerCase() + "/" + categoryId);
|
640 |
params.put("CATEGORY_URL", categoryName.replaceAll(" ", "-").toLowerCase() + "/" + categoryId);
|
| - |
|
641 |
params.put("PRODUCT_URL", URLEncoder.encode("http://www."+ domain + this.getEntityURL(expEntity), "UTF-8"));
|
| - |
|
642 |
if(expEntity.getCategory().getParentCategory().getID() == Utils.MOBILE_PHONES_CATAGOEY){
|
| - |
|
643 |
params.put("IS_MOBILE", "TRUE" );
|
| - |
|
644 |
}else{
|
| - |
|
645 |
params.put("IS_MOBILE", "FALSE" );
|
| 640 |
|
646 |
}
|
| 641 |
params.put("CATALOG_ID", ((int)catalogId)+"");
|
647 |
params.put("CATALOG_ID", ((int)catalogId)+"");
|
| 642 |
params.put("TAGLINE", tagline);
|
648 |
params.put("TAGLINE", tagline);
|
| 643 |
params.put("WARRANTY", warranty);
|
649 |
params.put("WARRANTY", warranty);
|
| 644 |
|
650 |
|
| 645 |
VelocityContext context = new VelocityContext();
|
651 |
VelocityContext context = new VelocityContext();
|