-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPropertyController.java
More file actions
52 lines (42 loc) · 2.13 KB
/
PropertyController.java
File metadata and controls
52 lines (42 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.julius.spring.boot.ethweb3.controller;
import com.julius.spring.boot.ethweb3.service.PropertyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.math.BigInteger;
import java.util.List;
@RestController
public class PropertyController {
private static final Logger logger = LoggerFactory.getLogger(PropertyController.class);
private final PropertyService propertyService;
public PropertyController(PropertyService propertyService) {
this.propertyService = propertyService;
}
@GetMapping(path = "/api/property/{propertyId}/value")
public BigInteger retrievePropertyValue(@PathVariable("propertyId") String propertyId){
logger.info("retrievePropertyValue");
return propertyService.getPropertyValue(propertyId);
}
@GetMapping(path = "/api/property/{propertyId}/name")
public String retrievePropertyName(@PathVariable("propertyId") String propertyId){
logger.info("retrievePropertyName");
return propertyService.getPropertyName(propertyId);
}
@GetMapping(path = "/api/property/{propertyId}/description")
public String retrievePropertyDescription(@PathVariable("propertyId") String propertyId){
logger.info("retrievePropertyDescription");
return propertyService.getPropertyDescription(propertyId);
}
@PostMapping(path = "/api/property/{propertyId}/description")
public String setPropertyDescription(@PathVariable("propertyId") String propertyId, @RequestParam("description") String description){
logger.info("setPropertyDescription");
propertyService.setPropertyDescription(propertyId, description);
return "successfully set description for property " + propertyId;
}
@GetMapping(path = "/api/property/{propertyId}/sum")
public BigInteger usePropertyContractSumFunction(@PathVariable("propertyId") String propertyId, @RequestParam("a") int a, @RequestParam("b") int b){
logger.info("usePropertyContractSumFunction");
return propertyService.useSumFunction(propertyId, a, b);
}
}