@RestController
@CrossOrigin
@RequestMapping(value="/areas/{areaId}/zones")
public class ZoneController
extends java.lang.Object
Constructor and Description |
---|
ZoneController(ZoneService zoneService) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
createZone(java.util.UUID areaID,
@Valid ZoneRequest request)
Creates a new zone
|
void |
deleteZone(java.util.UUID areaID,
int zoneNumber,
boolean hard)
Deletes a zone
|
ZoneView |
getZone(java.util.UUID areaID,
int zoneNumber)
Returns object representing a specific zone
|
java.lang.Iterable<ZoneView> |
getZones(java.util.UUID areaID,
boolean activeOnly)
Returns all zones of the given area
|
ZoneView |
updateZone(java.util.UUID areaID,
int zoneNumber,
@Valid ZoneRequest request)
Updates an existing zone
|
@Autowired public ZoneController(ZoneService zoneService)
@GetMapping(value="") public java.lang.Iterable<ZoneView> getZones(@PathVariable(value="areaId") java.util.UUID areaID, @RequestParam(value="active_only",defaultValue="true") boolean activeOnly)
areaID
- the ID of the area whose zones should be fetchedactiveOnly
- if true, only active zones will be returned, if false, all zones
will be returned@GetMapping(value="/{zone_number}") public ZoneView getZone(@PathVariable(value="areaId") java.util.UUID areaID, @PathVariable(value="zone_number") int zoneNumber)
areaID
- the ID of the area to which the zone belongszoneNumber
- the number that uniquely identifies the zone within the area@PostMapping(value="") @ResponseStatus(value=CREATED) public java.lang.String createZone(@PathVariable(value="areaId") java.util.UUID areaID, @Valid @RequestBody @Valid ZoneRequest request)
areaID
- the ID of the area to which the zone should be addedrequest
- object containing parameters of the new zone@PutMapping(value="/{zone_number}") public ZoneView updateZone(@PathVariable(value="areaId") java.util.UUID areaID, @PathVariable(value="zone_number") int zoneNumber, @Valid @RequestBody @Valid ZoneRequest request)
areaID
- the ID of the area to which the zone belongszoneNumber
- the number that uniquely identifies the zone within the arearequest
- object containing parameters of the new zone@DeleteMapping(value="/{zone_number}") @ResponseStatus(value=NO_CONTENT) public void deleteZone(@PathVariable(value="areaId") java.util.UUID areaID, @PathVariable(value="zone_number") int zoneNumber, @RequestParam(value="hard",defaultValue="false") boolean hard)
areaID
- the ID of the area to which the zone belongszoneNumber
- the number that uniquely identifies the zone within the areahard
- if true, the zone is permanently deleted from the database, if false,
it is flagged as inactive. Inactive zones still exist, but they and any other data
related to them (including transits though them) are not returned by public APIs
unless explicitly requested