Class ProjectController

java.lang.Object
com.skava.promotion.web.ProjectController

@RestController @RequestMapping("/projects") public class ProjectController extends Object

This class contains the functionalities to perform CRUD operations on a project

Since:
8.0
Version:
8.0
Author:
Infosys Equinox
  • Constructor Details

    • ProjectController

      public ProjectController()
      No arguments constructor
  • Method Details

    • createProject

      @ResponseStatus(CREATED) @PostMapping @PreAuthorize("hasPrivilegeForServiceAndCollection(\'promotion/create/project\', \'promotion\',#collectionId)") @Audit public org.springframework.http.ResponseEntity<ProjectAPIResponse> createProject(@RequestHeader(value="x-auth-token",required=true) @IgnoreAudit String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="Version Id") String versionId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="Collection Id") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @Valid @RequestBody(required=true) @AuditField(field="Project request") @Valid ProjectRequest request)
      Functionality to create a project based on the attributes presents in ProjectRequest instance.
      Parameters:
      authToken - An unique token used to authorize the user.
      collectionId - Project is created under the specified collection id.
      request - Contains attributes that are required for the creation of a Project.
      locale - Response message would be rendered in the mentioned locale.
      versionId - It refers to the version value of the API.
      Returns:
      Returns the instance of ProjectAPIResponse.
    • findAllProject

      @ResponseStatus(OK) @GetMapping @PreAuthorize("hasPrivilegeForServiceAndCollection(\'promotion/viewall/project\',\'promotion\', #collectionId) or hasRoleByName(\'ROLE_REG_USER\') or hasRoleByName(\'ROLE_GUEST\')") @Audit public org.springframework.http.ResponseEntity<ProjectsAPIResponse> findAllProject(@RequestHeader(value="x-auth-token",required=true) @IgnoreAudit String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="Version Id") String versionId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="Collection Id") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestParam(value="sort",required=false) @AuditField(field="Sort") EcomSorts sort, @RequestParam(value="filters",required=false) @AuditField(field="Filters") String filters, @RequestParam(value="page",required=false,defaultValue="1") @AuditField(field="Page No.") int page, @RequestParam(value="size",required=false,defaultValue="10") @AuditField(field="Size") int size)
      Loads all the projects that are associated with the collection id.
      Parameters:
      authToken - An unique token used to authorize the user.
      collectionId - Holds a collection Id to load all projects under a specified collection.
      locale - Response message would be rendered in the mentioned locale.
      sort - Holds the parameters for sorting.
      filters - Holds the description for request parameter filter/search.
      page - To mention the index for loading the collection.
      size - To mention the number of maximum items that can be fetched from the DB.
      versionId - It refers to the version value of the API.
      Returns:
      Returns the instance of ProjectsAPIResponse
    • getProjectById

      @ResponseStatus(OK) @GetMapping("/{projectId}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'promotion/view/project\', \'promotion\',#collectionId) or hasRoleByName(\'ROLE_REG_USER\') or hasRoleByName(\'ROLE_GUEST\')") @Audit public org.springframework.http.ResponseEntity<ProjectAPIResponse> getProjectById(@RequestHeader(value="x-auth-token",required=true) @IgnoreAudit String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="Version Id") String versionId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="Collection Id") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(value="projectId",required=true) @AuditField(field="Project Id") String projectId)
      Functionality to load a Project based on the given Project Id
      Parameters:
      authToken - An unique token used to authorize the user.
      projectId - ID of the project to be loaded.
      collectionId - project is loaded under the specified collection id.
      locale - Response message would be rendered in the mentioned locale.
      versionId - It refers to the version value of the API.
      Returns:
      Returns the instance of ProjectAPIResponse.
    • updateProject

      @ResponseStatus(OK) @PutMapping("/{projectId}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'promotion/update/project\', \'promotion\', #collectionId)") @Audit public org.springframework.http.ResponseEntity<ProjectAPIResponse> updateProject(@RequestHeader(value="x-auth-token",required=true) @IgnoreAudit String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="Version Id") String versionId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="Collection Id") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(value="projectId",required=true) @AuditField(field="Project Id") String projectId, @Valid @RequestBody(required=true) @AuditField(field="Project request") @Valid ProjectRequest request)
      Updates all field in the Project based on the given request.
      Parameters:
      authToken - An unique token used to authorize the user.
      versionId - It refers to the version value of the API.
      collectionId - Holds a collection Id to update a project under a specified collection
      locale - Response message would be rendered in the mentioned locale.
      projectId - ID of the project that needs to be updated .
      request - Contains attributes that are required to update all the fields.
      Returns:
      Returns the instance of ProjectAPIResponse.
    • patchUpdate

      @ResponseStatus(OK) @PatchMapping("/{projectId}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'promotion/update/project\', \'promotion\', #collectionId)") @Audit public org.springframework.http.ResponseEntity<ProjectAPIResponse> patchUpdate(@RequestHeader(value="x-auth-token",required=true) @IgnoreAudit String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="Version Id") String versionId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="Collection Id") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(value="projectId",required=true) @AuditField(field="Project Id") String projectId, @RequestBody(required=true) @AuditField(field="Project request") ProjectRequest request)
      Functionality to update a project.
      Parameters:
      authToken - An unique token used to authorize the user.
      versionId - It refers to the version value of the API.
      collectionId - Project resides under the mentioned collection id.
      locale - Response message would be rendered in the mentioned locale.
      projectId - ID of the project that needs to be updated.
      request - Contains attributes that are required to update the Project.
      Returns:
      Returns the instance of ProjectAPIResponse.
    • initBinder

      @InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)