Subversion Repositories SmartDukaan

Rev

Rev 32584 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24349 amit.gupta 1
package com.spice.profitmandi.web.config;
2
 
37846 amit 3
import com.spice.profitmandi.service.warehouse.BillingWarehouseService;
32569 amit.gupta 4
import org.apache.logging.log4j.LogManager;
5
import org.apache.logging.log4j.Logger;
37846 amit 6
import org.springframework.beans.factory.annotation.Autowired;
24349 amit.gupta 7
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
8
import org.springframework.web.bind.WebDataBinder;
9
import org.springframework.web.bind.annotation.ControllerAdvice;
10
import org.springframework.web.bind.annotation.InitBinder;
37846 amit 11
import org.springframework.web.bind.annotation.ModelAttribute;
24349 amit.gupta 12
 
37846 amit 13
import java.util.Map;
14
 
32569 amit.gupta 15
@ControllerAdvice(basePackages = "com.spice.profitmandi")
16
 
24349 amit.gupta 17
public class ControllerSetup
18
{
32569 amit.gupta 19
    private static final Logger LOGGER = LogManager.getLogger(ControllerSetup.class);
37846 amit 20
 
21
    @Autowired
22
    private BillingWarehouseService billingWarehouseService;
23
 
24349 amit.gupta 24
    @InitBinder
32171 jai.hind 25
    public void initBinder ( WebDataBinder binder )
24349 amit.gupta 26
    {
32584 raveendra. 27
        StringTrimmerEditor stringtrimmer = new StringTrimmerEditor(false);
24349 amit.gupta 28
        binder.registerCustomEditor(String.class, stringtrimmer);
29
    }
37846 amit 30
 
31
    // Name of any billing warehouse, whatever its status, for views that label rows by the warehouse in the data;
32
    // $warehouseMap stays the list a screen offers (active only on dashboards).
33
    @ModelAttribute("warehouseNames")
34
    public Map<Integer, String> warehouseNames() {
35
        return billingWarehouseService.getAllNames();
36
    }
24349 amit.gupta 37
}