Subversion Repositories SmartDukaan

Rev

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

Rev 2754 Rev 2867
Line 8... Line 8...
8
import java.io.IOException;
8
import java.io.IOException;
9
 
9
 
10
import org.apache.log4j.Logger;
10
import org.apache.log4j.Logger;
11
 
11
 
12
@SuppressWarnings("serial")
12
@SuppressWarnings("serial")
13
public class RelatedProductsController extends BaseController {
13
public class MostComparedProductsController extends BaseController {
14
 
14
 
15
	private static final String relatedProductsFileName = "MostComparedProducts.html";
15
	private static final String relatedProductsFileName = "MostComparedProducts.html";
16
	private static final int limit = 4;  
-
 
17
    private static Logger logger = Logger.getLogger(RelatedProductsController.class);
16
	private static Logger logger = Logger.getLogger(MostComparedProductsController.class);
18
	private String id;
17
	private String id;
19
    private String snippets="";
18
    private String snippets="";
20
 
19
 
21
	public RelatedProductsController(){
20
	public MostComparedProductsController(){
22
		super();
21
		super();
23
	}
22
	}
24
 
23
 
25
    public String show() {
24
    public String show() {
26
        return "show";
25
        return "show";
Line 41... Line 40...
41
	    catch (IOException e) {
40
	    catch (IOException e) {
42
	        logger.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + id + File.separator + relatedProductsFileName);
41
	        logger.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + id + File.separator + relatedProductsFileName);
43
	    }
42
	    }
44
	    if(!itemIds.equals("")){
43
	    if(!itemIds.equals("")){
45
	    	String[] items = itemIds.split("\\s|\\n|\\t");
44
	    	String[] items = itemIds.split("\\s|\\n|\\t");
46
	    	int count = 0;
-
 
47
	    	for(String item: items){
45
	    	for(String item: items){
48
	    		if(limit <= count){
-
 
49
	    			break;
-
 
50
	    		}
-
 
51
	    		try{
46
	    		try{
52
	    			long itemId = Long.parseLong(item.trim());
47
	    			long itemId = Long.parseLong(item.trim());
53
		    		try {
48
		    		try {
54
						snippets += FileUtils.read( Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + "WidgetSnippet.html");
49
						snippets += FileUtils.read( Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + "WidgetSnippet.html");
55
						count++;
-
 
56
			    	}
50
			    	}
57
		            catch (FileNotFoundException e) {
51
		            catch (FileNotFoundException e) {
58
		                logger.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
52
		                logger.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
59
		            }
53
		            }
60
		            catch (IOException e) {
54
		            catch (IOException e) {