Demo entry 6678581

DataResource

   

Submitted by anonymous on Dec 06, 2017 at 13:29
Language: Java. Code size: 1.1 kB.

import com.ecoprobio.data4klha.service.KlhaCurrentIndicesService;
import com.ecoprobio.data4klha.service.KlhaDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
public class DataResource {

    @Autowired
    KlhaDataService klhaDataService;
    @Autowired
    KlhaCurrentIndicesService klhaCurrentIndicesService;

    @GetMapping(value ="/indices")
    public ResponseEntity currentIndices(){
        return ResponseEntity.ok(
                klhaCurrentIndicesService.queryCurrentGatewayIndices()
        );
    }

    @GetMapping(value ="/indices")
    public ResponseEntity queryStatLine(@RequestParam("gateway_no") String gatewayNo,
                                        @RequestParam("sensor_no") String sensorNo){
        return ResponseEntity.ok(
                klhaCurrentIndicesService.queryIndicesGraphLines(gatewayNo, sensorNo)
        );
    }

}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).