Subversion Repositories SmartDukaan

Rev

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

Rev 5050 Rev 5173
Line 18... Line 18...
18
import in.shop2020.model.v1.catalog.Item;
18
import in.shop2020.model.v1.catalog.Item;
19
import in.shop2020.model.v1.catalog.status;
19
import in.shop2020.model.v1.catalog.status;
20
import in.shop2020.thrift.clients.CatalogClient;
20
import in.shop2020.thrift.clients.CatalogClient;
21
import in.shop2020.util.EntityUtils;
21
import in.shop2020.util.EntityUtils;
22
import in.shop2020.util.Utils;
22
import in.shop2020.util.Utils;
-
 
23
import in.shop2020.utils.Logger;
23
 
24
 
24
import java.io.BufferedWriter;
25
import java.io.BufferedWriter;
25
import java.io.File;
26
import java.io.File;
26
import java.io.FileInputStream;
27
import java.io.FileInputStream;
27
import java.io.FileOutputStream;
28
import java.io.FileOutputStream;
Line 67... Line 68...
67
    private String     contentVersion;
68
    private String     contentVersion;
68
 
69
 
69
    public NewVUI(Long contentVersion) throws Exception {
70
    public NewVUI(Long contentVersion) throws Exception {
70
        this.contentVersion = contentVersion.toString();
71
        this.contentVersion = contentVersion.toString();
71
    }
72
    }
-
 
73
    
-
 
74
    static Client cl;
-
 
75
    
-
 
76
    static {
-
 
77
    	try{
-
 
78
    		cl = new CatalogClient().getClient();
-
 
79
    	}catch (Exception e){
-
 
80
    		e.printStackTrace();
-
 
81
    	}
-
 
82
    }
-
 
83
 
72
 
84
 
73
    private void copyDocuments(ExpandedEntity expEntity, String documentPrefix) throws IOException {
85
    private void copyDocuments(ExpandedEntity expEntity, String documentPrefix) throws IOException {
74
        long catalogId = expEntity.getID();
86
        long catalogId = expEntity.getID();
75
        String destinationDirectory = Utils.EXPORT_PATH + "documents"
87
        String destinationDirectory = Utils.EXPORT_PATH + "documents"
76
                + File.separator + catalogId;
88
                + File.separator + catalogId;
Line 532... Line 544...
532
                	Predicate activeOnly =new Predicate() {
544
                	Predicate activeOnly =new Predicate() {
533
						
545
						
534
						@Override
546
						@Override
535
						public boolean evaluate(Object arg0) {
547
						public boolean evaluate(Object arg0) {
536
							Long entityId = (Long)arg0;
548
							Long entityId = (Long)arg0;
537
							CatalogClient cc;
-
 
538
							boolean returnVal = false;
549
							boolean returnVal = false;
-
 
550
							List<Item> items = null;
539
							try {
551
							try {
-
 
552
								try {
540
								cc = new CatalogClient();
553
									items = cl.getItemsByCatalogId(entityId);
-
 
554
								} catch (Exception e) {
-
 
555
									Logger.log("Error:", e);
541
								Client cl = cc.getClient();
556
									cl = new CatalogClient().getClient();
542
								List<Item> items = cl.getItemsByCatalogId(entityId);
557
									items = cl.getItemsByCatalogId(entityId);
-
 
558
								}
543
								for(Item item: items){
559
								for(Item item: items){
544
									if(item.getItemStatus().equals(status.ACTIVE)){
560
									if(item.getItemStatus().equals(status.ACTIVE)){
545
										returnVal = true;
561
										returnVal = true;
546
										break;
562
										break;
547
									}
563
									}
Line 738... Line 754...
738
                URLEncoder.encode("http://www.", "UTF-8")
754
                URLEncoder.encode("http://www.", "UTF-8")
739
                        + "${domain}"
755
                        + "${domain}"
740
                        + URLEncoder.encode(
756
                        + URLEncoder.encode(
741
                                EntityUtils.getEntityURL(expEntity), "UTF-8"));
757
                                EntityUtils.getEntityURL(expEntity), "UTF-8"));
742
        
758
        
743
        if (parentCategory.isHasAccessories())	{
759
        if (parentCategory.isComparable())	{
744
        	params.put("IS_COMPARABLE", "TRUE");
760
        	params.put("IS_COMPARABLE", "TRUE");
745
        } else	{
761
        } else	{
746
        	params.put("IS_COMPARABLE", "FALSE");
762
        	params.put("IS_COMPARABLE", "FALSE");
747
        }
763
        }
748
        
764
        
Line 816... Line 832...
816
        Category parentCategory = expEntity.getCategory().getParentCategory();
832
        Category parentCategory = expEntity.getCategory().getParentCategory();
817
        if(parentCategory.isComparable()){
833
        if(parentCategory.isComparable()){
818
        	filenames.add("CompareProductSnippet");
834
        	filenames.add("CompareProductSnippet");
819
        	filenames.add("ComparisonSnippet");
835
        	filenames.add("ComparisonSnippet");
820
        	filenames.add("CompareProductSummarySnippet");
836
        	filenames.add("CompareProductSummarySnippet");
-
 
837
        	getMostComparedProducts(expEntity, exportPath);
821
        	getSlidenamesSnippet(expEntity, exportPath);
838
        	getSlidenamesSnippet(expEntity, exportPath);
822
        }
839
        }
823
        if(parentCategory.isHasAccessories()){
840
        if(parentCategory.isHasAccessories()){
824
        	getRelatedAccessories(expEntity, exportPath);
841
        	getRelatedAccessories(expEntity, exportPath);
825
        }
842
        }
826
        if(parentCategory.getID()==Utils.MOBILE_PHONES_CATAGORY){
843
        if(parentCategory.getID()==Utils.MOBILE_PHONES_CATAGORY){
827
        	getMostComparedProducts(expEntity, exportPath);
-
 
828
        	filenames.add("PhonesIOwnSnippet");
844
        	filenames.add("PhonesIOwnSnippet");
829
        }
845
        }
830
//        if (expEntity.getCategory().getParentCategory().getID() != Utils.MOBILE_ACCESSORIES_CATEGORY) {
846
//        if (expEntity.getCategory().getParentCategory().getID() != Utils.MOBILE_ACCESSORIES_CATEGORY) {
831
//
847
//
832
//        	// For laptops we do not have related accessories and most comparable
848
//        	// For laptops we do not have related accessories and most comparable