Package de.trustable.ca3s.core.web.rest
Class TenantResource
- java.lang.Object
-
- de.trustable.ca3s.core.web.rest.TenantResource
-
-
Constructor Summary
Constructors Constructor Description TenantResource(TenantService tenantService, TenantRepository tenantRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<Tenant>createTenant(@Valid Tenant tenant)POST /tenants: Create a new tenant.org.springframework.http.ResponseEntity<Void>deleteTenant(Long id)DELETE /tenants/:id: delete the "id" tenant.List<Tenant>getAllTenants()GET /tenants: get all the tenants.org.springframework.http.ResponseEntity<Tenant>getTenant(Long id)GET /tenants/:id: get the "id" tenant.org.springframework.http.ResponseEntity<Tenant>partialUpdateTenant(Long id, @NotNull Tenant tenant)PATCH /tenants/:id: Partial updates given fields of an existing tenant, field will ignore if it is nullorg.springframework.http.ResponseEntity<Tenant>updateTenant(Long id, @Valid Tenant tenant)PUT /tenants/:id: Updates an existing tenant.
-
-
-
Constructor Detail
-
TenantResource
public TenantResource(TenantService tenantService, TenantRepository tenantRepository)
-
-
Method Detail
-
createTenant
@PostMapping("/tenants") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") public org.springframework.http.ResponseEntity<Tenant> createTenant(@Valid @RequestBody @Valid Tenant tenant) throws URISyntaxExceptionPOST /tenants: Create a new tenant.- Parameters:
tenant- the tenant to create.- Returns:
- the
ResponseEntitywith status201 (Created)and with body the new tenant, or with status400 (Bad Request)if the tenant has already an ID. - Throws:
URISyntaxException- if the Location URI syntax is incorrect.
-
updateTenant
@PutMapping("/tenants/{id}") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") public org.springframework.http.ResponseEntity<Tenant> updateTenant(@PathVariable(value="id",required=false) Long id, @Valid @RequestBody @Valid Tenant tenant) throws URISyntaxExceptionPUT /tenants/:id: Updates an existing tenant.- Parameters:
id- the id of the tenant to save.tenant- the tenant to update.- Returns:
- the
ResponseEntitywith status200 (OK)and with body the updated tenant, or with status400 (Bad Request)if the tenant is not valid, or with status500 (Internal Server Error)if the tenant couldn't be updated. - Throws:
URISyntaxException- if the Location URI syntax is incorrect.
-
partialUpdateTenant
@PatchMapping(value="/tenants/{id}", consumes={"application/json","application/merge-patch+json"}) @PreAuthorize("hasRole(\"ROLE_ADMIN\")") public org.springframework.http.ResponseEntity<Tenant> partialUpdateTenant(@PathVariable(value="id",required=false) Long id, @NotNull @RequestBody @NotNull Tenant tenant) throws URISyntaxExceptionPATCH /tenants/:id: Partial updates given fields of an existing tenant, field will ignore if it is null- Parameters:
id- the id of the tenant to save.tenant- the tenant to update.- Returns:
- the
ResponseEntitywith status200 (OK)and with body the updated tenant, or with status400 (Bad Request)if the tenant is not valid, or with status404 (Not Found)if the tenant is not found, or with status500 (Internal Server Error)if the tenant couldn't be updated. - Throws:
URISyntaxException- if the Location URI syntax is incorrect.
-
getAllTenants
@GetMapping("/tenants") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") public List<Tenant> getAllTenants()GET /tenants: get all the tenants.- Returns:
- the
ResponseEntitywith status200 (OK)and the list of tenants in body.
-
getTenant
@GetMapping("/tenants/{id}") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") public org.springframework.http.ResponseEntity<Tenant> getTenant(@PathVariable Long id)GET /tenants/:id: get the "id" tenant.- Parameters:
id- the id of the tenant to retrieve.- Returns:
- the
ResponseEntitywith status200 (OK)and with body the tenant, or with status404 (Not Found).
-
deleteTenant
@DeleteMapping("/tenants/{id}") @PreAuthorize("hasRole(\"ROLE_ADMIN\")") public org.springframework.http.ResponseEntity<Void> deleteTenant(@PathVariable Long id)DELETE /tenants/:id: delete the "id" tenant.- Parameters:
id- the id of the tenant to delete.- Returns:
- the
ResponseEntitywith status204 (NO_CONTENT).
-
-