Subversion Repositories SmartDukaan

Rev

Rev 9269 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9269 Rev 20825
Line 1... Line 1...
1
package in.shop2020.mobileapi.serving.services;
1
package in.shop2020.mobileapi.serving.services;
2
 
2
 
3
import in.shop2020.logistics.PickupStore;
3
import in.shop2020.logistics.PickupStore;
4
import in.shop2020.logistics.Provider;
4
import in.shop2020.logistics.Provider;
5
import in.shop2020.mobileapi.serving.utils.FormattingUtils;
-
 
6
import in.shop2020.mobileapi.serving.utils.Utils;
5
import in.shop2020.mobileapi.serving.utils.Utils;
7
import in.shop2020.model.v1.order.Order;
6
import in.shop2020.model.v1.order.Order;
8
import in.shop2020.model.v1.order.OrderSource;
7
import in.shop2020.model.v1.order.OrderSource;
9
import in.shop2020.model.v1.order.OrderStatus;
8
import in.shop2020.model.v1.order.OrderStatus;
10
import in.shop2020.model.v1.order.OrderStatusGroups;
9
import in.shop2020.model.v1.order.OrderStatusGroups;
Line 42... Line 41...
42
 
41
 
43
public class PageLoaderHandler {
42
public class PageLoaderHandler {
44
 
43
 
45
    private static Logger logger = Logger.getLogger(PageLoaderHandler.class);
44
    private static Logger logger = Logger.getLogger(PageLoaderHandler.class);
46
    
45
    
-
 
46
    static {
-
 
47
    	try {
-
 
48
	    	Properties p = new Properties();
-
 
49
			p.setProperty("resource.loader", "class");
-
 
50
			p.setProperty("class.resource.loader.class",
-
 
51
			"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
-
 
52
			p.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogSystem"); 
-
 
53
			Velocity.init(p);
-
 
54
    	} catch(Exception e) {
-
 
55
    		e.printStackTrace();
-
 
56
    	}
-
 
57
    }
-
 
58
    
47
	public String getSlideGuideHtml(long productId) {
59
	public String getSlideGuideHtml(long productId) {
48
		StringBuilder htmlString = new StringBuilder();
60
		StringBuilder htmlString = new StringBuilder();
49
		String filename = Utils.EXPORT_ENTITIES_PATH + productId + File.separator + "SlideGuide.html";
61
		String filename = Utils.EXPORT_ENTITIES_PATH + productId + File.separator + "SlideGuide.html";
50
		File f = new File(filename);
62
		File f = new File(filename);
51
		
63
		
Line 421... Line 433...
421
		htmlString = getHtmlFromVelocity(templateFile, context);
433
		htmlString = getHtmlFromVelocity(templateFile, context);
422
		return htmlString;
434
		return htmlString;
423
	}
435
	}
424
 
436
 
425
	public String getHtmlFromVelocity(String templateFile, VelocityContext context){
437
	public String getHtmlFromVelocity(String templateFile, VelocityContext context){
426
		Properties p = new Properties();
-
 
427
		p.setProperty("resource.loader", "class");
-
 
428
		p.setProperty("class.resource.loader.class",
-
 
429
		"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
-
 
430
		p.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogSystem"); 
-
 
431
		
-
 
432
        try {
438
        try {
433
            Velocity.init(p);
-
 
434
            // Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, value)
439
            // Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, value)
435
            Template template = Velocity.getTemplate(templateFile);
440
            Template template = Velocity.getTemplate(templateFile);
436
            if (template != null) {
441
            if (template != null) {
437
                StringWriter writer = new StringWriter();
442
                StringWriter writer = new StringWriter();
438
                template.merge(context, writer);
443
                template.merge(context, writer);