Package com.skava.foundation.web
Class SiteDataController
java.lang.Object
com.skava.foundation.web.BaseController
com.skava.foundation.web.SiteDataController
@RestController
@Validated
@RequestMapping("/siteData")
public class SiteDataController
extends BaseController
SiteData controller class contains common operations related to siteData operations.
- Since:
- 8.0
- Version:
- 8.0
- Author:
- Infosys Equinox
-
Field Summary
Fields inherited from class com.skava.foundation.web.BaseController
DEFAULT_API_LOCALE, DEFAULT_API_VERSION, INVALID_REQUEST_DATA, message
-
Constructor Summary
ConstructorsConstructorDescriptionSiteDataController
(Message message, SiteDataService siteDataService) Default Constructor -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<SiteDataResponse>
create
(String authToken, @Valid SiteDataRequest request, String locale, Long siteId, String version) org.springframework.http.ResponseEntity<com.skava.core.ResponseModel>
deleteById
(String authToken, @Min(1L) Long id, String locale, String version) This method is used to delete single SiteData property on given request.filterRequestParam
(int page, int size, String search, String filters, org.springframework.data.domain.Sort sort) org.springframework.http.ResponseEntity<List<SiteDataResponse>>
findAll
(String authToken, String locale, String version, Long siteId, @Valid FilterRequestParam filter) Loads all the siteData.org.springframework.http.ResponseEntity<SiteDataResponse>
Loads a siteData by id.org.springframework.http.ResponseEntity<SiteDataResponse>
replaceSiteData
(String authToken, String locale, String version, @Valid SiteDataRequest request, Long id, Long siteId) org.springframework.http.ResponseEntity<SiteDataResponse>
updateSiteData
(String authToken, String locale, String version, @Valid SiteDataRequest request, Long id, Long siteId) Methods inherited from class com.skava.foundation.web.BaseController
buildResponse, getErrorCode, getErrorMessage, getFailureResponseModel, handleAlreadyExistException, handleExceptionBadRequest, handleExceptionNotFound
-
Constructor Details
-
SiteDataController
Default Constructor
-
-
Method Details
-
create
@ResponseStatus(CREATED) @PostMapping(value="", consumes="application/json") @PreAuthorize("hasRoleByName(\'ROLE_SELLER_USER\')") public org.springframework.http.ResponseEntity<SiteDataResponse> create(@RequestHeader(value="x-auth-token",required=true) String authToken, @Valid @RequestBody(required=true) @Valid SiteDataRequest request, @RequestHeader(value="x-locale",required=false,defaultValue="en_US") String locale, @RequestParam(value="siteId",required=true) Long siteId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version)
Creates a new siteData.
Following are the conditions for creating a siteData :
- request should not be null.
- request.Id should not be null.
- request.config should not be null.
- request.complexity should not be null.
- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.version
- It hold the value of version number of API. Using this parameter we can access the different version of the API.request
- Instance ofSiteData
.siteId
- Unique Identifier of SiteDataBelow are the handled exceptions
- If any of the field in request is invalid, then '400 Bad request' is thrown.
- If the request.id is null, then 'id.id.Range' is thrown.
- If the request.config is null, then 'siteData.config.NotNull' is thrown.
- If the size of request.config is invalid, then 'siteData.config.size' is thrown.
- If the request.complexity is null, then 'siteData.complexity.NotNull' is thrown.
- If the size of request.complexity is invalid, then 'siteData.complexity.size' is thrown.
- Returns:
- A
SiteData
object.
-
findAll
@ResponseStatus(OK) @GetMapping public org.springframework.http.ResponseEntity<List<SiteDataResponse>> findAll(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-locale",required=false,defaultValue="en_US") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version, @RequestParam(value="siteId",required=true) Long siteId, @Valid @ModelAttribute("filter") @Valid FilterRequestParam filter) Loads all the siteData.- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.version
- It hold the value of version number of API. Using thissiteId
- Unique Identifier of SiteData- Returns:
- List of
SiteData
.
-
findById
@ResponseStatus(OK) @GetMapping("/{sitedataId}") @PreAuthorize("hasRoleByName(\'ROLE_SELLER_USER\')") public org.springframework.http.ResponseEntity<SiteDataResponse> findById(@RequestHeader(value="x-auth-token",required=true) String authToken, @PathVariable(value="sitedataId",required=true) @Min(1L) @Min(1L) Long id, @RequestHeader(value="x-locale",required=false,defaultValue="en_US") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version) Loads a siteData by id.- Parameters:
locale
- API Response and error messages will be responded in the locale mentioned in this parameter.version
- It hold the value of version number of API. Using this parameter we can access the different version of the API. This token is used to authenticate the request.id
- Unique identifier of the siteData to be loaded.authToken
- Contains auth token.- Returns:
- A
SiteData
object.
-
deleteById
@ResponseStatus(OK) @DeleteMapping("/{sitedataId}") @PreAuthorize("hasRoleByName(\'ROLE_SELLER_USER\')") public org.springframework.http.ResponseEntity<com.skava.core.ResponseModel> deleteById(@RequestHeader(value="x-auth-token",required=true) String authToken, @PathVariable(value="sitedataId",required=true) @Min(1L) @Min(1L) Long id, @RequestHeader(value="x-locale",required=false,defaultValue="en_US") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version) This method is used to delete single SiteData property on given request.- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.version
- versionid
- Unique Identifier of SiteData- Returns:
- A Instance of
SiteData
.
-
replaceSiteData
@ResponseStatus(OK) @PatchMapping(value="/{sitedataId}", produces="application/json") @PreAuthorize("hasRoleByName(\'ROLE_SELLER_USER\')") public org.springframework.http.ResponseEntity<SiteDataResponse> replaceSiteData(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-locale",required=false,defaultValue="en_US") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version, @Valid @RequestBody(required=true) @Valid SiteDataRequest request, @PathVariable(value="sitedataId",required=true) Long id, @RequestParam(value="siteId",required=true) Long siteId)
Update the existing siteData. Only siteData details can be updated. Association details cannot be updated.
- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.version
- It hold the value of version number of API. Using this parameter we can access the different version of the API.id
- Indicates the id of the siteData.request
- Request Body of the DatasiteId
- Indicates the id of the site.- Returns:
- A
SiteData
object.
-
updateSiteData
@ResponseStatus(OK) @PutMapping("/{sitedataId}") @PreAuthorize("hasRoleByName(\'ROLE_SELLER_USER\')") public org.springframework.http.ResponseEntity<SiteDataResponse> updateSiteData(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-locale",required=false,defaultValue="en_US") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version, @Valid @RequestBody(required=true) @Valid SiteDataRequest request, @PathVariable(value="sitedataId",required=true) Long id, @RequestParam(value="siteId",required=true) Long siteId)
Updates an existing siteData with given id.
Following are the conditions for updating a siteData:
- request should not be null.
- request.Id should not be null.
- request.config should not be null.
- request.complexity should not be null.
- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.version
- It hold the value of version number of API. Using this parameter we can access the different version of the API.request
- Contains the Request Body.id
- unique identifier for siteData.siteId
- Unique Identifier of SiteDataBelow are the handled exceptions
- If any of the field in request is invalid, then '400 Bad request' is thrown.
- If the request.id is null, then 'id.Range' is thrown.
- If the request.config is null, then 'siteData.config.NotNull' is thrown.
- If the size of request.config is invalid, then 'siteData.config.size' is thrown.
- If the request.complexity is null, then 'siteData.complexity.NotNull' is thrown.
- If the size of request.complexity is invalid, then 'siteData.complexity.size' is thrown.
- Returns:
- A
SiteData
object.
-
filterRequestParam
@ModelAttribute("filter") public FilterRequestParam filterRequestParam(@RequestParam(required=false,defaultValue="1") int page, @RequestParam(required=false,defaultValue="100") int size, @RequestParam(required=false) String search, @RequestParam(required=false) String filters, org.springframework.data.domain.Sort sort) - Parameters:
page
- This parameter will be available for all the services that support pagination. It indicates the starting index of the item to be responded by the API.size
- This parameter will be available for all the services that support pagination. It is used to specify the maximum number items that need to be responded for the request.search
- This parameter will be available for all the services that support search. It is used to specify the name,operator,value for a field to be searched.sort
- This parameter will be available for all the services that support sort. It is used to specify the sort field with order(ascending or descending) Default will be ascending.filters
- This parameter will be available for all the services that support filtration.- Returns:
- A
FilterRequestParam
object
-