@Controller
@RequestMapping("/data")
public class DataController
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
private AbstractAccessSensorService |
accessSensorService |
|
private DataFetchingAndMappingService |
dataFetchingAndMappingService |
|
private static org.apache.log4j.Logger |
logger |
Constructor | Description |
---|---|
DataController() |
Modifier and Type | Method | Description |
---|---|---|
int |
clearAllData() |
Delete all data in database.
|
java.util.List<java.lang.String[]> |
getAllBorderRouterIpAndName() |
get a list of "borderRouterIP, borderRouterName" pair for all border router in database.
|
DataPackage |
getAllCurrentData() |
Gets all current data from each sensor, not from database.
|
DataPackage |
getAllDataFromDatabase() |
Gets all data from database, map to a
DataPackage object. |
java.util.List<java.lang.String> |
getAllSensorIp() |
Gets all sensor ip.
|
BorderRouterWrapper |
getCurrentDataForBorderRouter(java.lang.String borderRouterIp) |
Fetching data from sensor for given border router.
|
BorderRouterWrapper |
getDataForBorderRouterFromDB(java.lang.String borderRouterIp) |
Fetching data from database for given border router.
|
SensorWrapper |
getHistoryDataBySensorIp(java.lang.String sensorIp) |
Get all history data entries for the input sensor IP.
|
java.util.List<java.lang.String> |
getSensorIpListByBorderRouterIp(java.lang.String borderRouterIp) |
Get all sensor IP for the input border router IP.
|
@Autowired private DataFetchingAndMappingService dataFetchingAndMappingService
@Autowired @Qualifier("mockAccessSensorService") private AbstractAccessSensorService accessSensorService
private static final org.apache.log4j.Logger logger
@RequestMapping(value="/getHistoryDataBySensorIp/{sensorIp}", method=GET, headers="ModelAttribute=getHistoryDataBySensorIp", produces="application/json", consumes="application/json") @ResponseBody public SensorWrapper getHistoryDataBySensorIp(@PathVariable java.lang.String sensorIp)
SensorWrapper
object.
If there is no data for the given sensor IP in database or the input sensor IP doesn't exist,
return null
.sensorIp
- path variable snesor IP@RequestMapping(value="/getSensorIpListByBorderRouterIp/{borderRouterIp}", method=GET, headers="ModelAttribute=getSensorIpListByBorderRouterIp", produces="application/json", consumes="application/json") @ResponseBody public java.util.List<java.lang.String> getSensorIpListByBorderRouterIp(@PathVariable java.lang.String borderRouterIp)
"[]"
.borderRouterIp
- path variable, border router IP.@RequestMapping(value="/getAllSensorIp", method=GET, headers="ModelAttribute=getAllSensorIp", produces="application/json", consumes="application/json") @ResponseBody public java.util.List<java.lang.String> getAllSensorIp()
"[]"
.String
contains all sensor IP addresses.@RequestMapping(value="/get/all/current", method=GET, headers="ModelAttribute=getAllDataFromSensor", produces="application/json", consumes="application/json") @ResponseBody public DataPackage getAllCurrentData() throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingException
@RequestMapping(value="/get/all/database", method=GET, headers="ModelAttribute=getAllDataFromDatabase", produces="application/json", consumes="application/json") @ResponseBody public DataPackage getAllDataFromDatabase()
DataPackage
object.@RequestMapping(value="/get/{borderRouterIp}/database", method=GET, headers="ModelAttribute=getDataForBorderRouterFromDatabase", produces="application/json", consumes="application/json") @ResponseBody public BorderRouterWrapper getDataForBorderRouterFromDB(@PathVariable java.lang.String borderRouterIp)
@RequestMapping(value="/delete/all", method=DELETE, headers="ModelAttribute=deleteAllData", produces="application/json", consumes="application/json") @ResponseBody public int clearAllData()
@RequestMapping(value="/get/{borderRouterIp}/sensor", method=GET, headers="ModelAttribute=getDataForBorderRouterFromSensor", produces="application/json", consumes="application/json") @ResponseBody public BorderRouterWrapper getCurrentDataForBorderRouter(@PathVariable java.lang.String borderRouterIp) throws com.fasterxml.jackson.core.JsonProcessingException
borderRouterIp
- parameter from path stringBorderRouterWrapper
com.fasterxml.jackson.core.JsonProcessingException
@RequestMapping(value="/get/borderRouterIpAndName", method=GET, headers="ModelAttribute=getAllBorderRouterIpAndName", produces="application/json", consumes="application/json") @ResponseBody public java.util.List<java.lang.String[]> getAllBorderRouterIpAndName()