| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.config;
|
1 |
package com.spice.profitmandi.web.config;
|
| 2 |
|
2 |
|
| - |
|
3 |
import com.spice.profitmandi.service.warehouse.BillingWarehouseService;
|
| 3 |
import org.apache.logging.log4j.LogManager;
|
4 |
import org.apache.logging.log4j.LogManager;
|
| 4 |
import org.apache.logging.log4j.Logger;
|
5 |
import org.apache.logging.log4j.Logger;
|
| - |
|
6 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 5 |
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
7 |
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
| 6 |
import org.springframework.web.bind.WebDataBinder;
|
8 |
import org.springframework.web.bind.WebDataBinder;
|
| 7 |
import org.springframework.web.bind.annotation.ControllerAdvice;
|
9 |
import org.springframework.web.bind.annotation.ControllerAdvice;
|
| 8 |
import org.springframework.web.bind.annotation.InitBinder;
|
10 |
import org.springframework.web.bind.annotation.InitBinder;
|
| - |
|
11 |
import org.springframework.web.bind.annotation.ModelAttribute;
|
| - |
|
12 |
|
| - |
|
13 |
import java.util.Map;
|
| 9 |
|
14 |
|
| 10 |
@ControllerAdvice(basePackages = "com.spice.profitmandi")
|
15 |
@ControllerAdvice(basePackages = "com.spice.profitmandi")
|
| 11 |
|
16 |
|
| 12 |
public class ControllerSetup
|
17 |
public class ControllerSetup
|
| 13 |
{
|
18 |
{
|
| 14 |
private static final Logger LOGGER = LogManager.getLogger(ControllerSetup.class);
|
19 |
private static final Logger LOGGER = LogManager.getLogger(ControllerSetup.class);
|
| - |
|
20 |
|
| - |
|
21 |
@Autowired
|
| - |
|
22 |
private BillingWarehouseService billingWarehouseService;
|
| - |
|
23 |
|
| 15 |
@InitBinder
|
24 |
@InitBinder
|
| 16 |
public void initBinder ( WebDataBinder binder )
|
25 |
public void initBinder ( WebDataBinder binder )
|
| 17 |
{
|
26 |
{
|
| 18 |
StringTrimmerEditor stringtrimmer = new StringTrimmerEditor(false);
|
27 |
StringTrimmerEditor stringtrimmer = new StringTrimmerEditor(false);
|
| 19 |
binder.registerCustomEditor(String.class, stringtrimmer);
|
28 |
binder.registerCustomEditor(String.class, stringtrimmer);
|
| 20 |
}
|
29 |
}
|
| - |
|
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 |
}
|
| 21 |
}
|
37 |
}
|