Class VariableController

java.lang.Object
app.valuationcontrol.webservice.model.variable.VariableController

@RestController @Transactional public class VariableController extends Object
  • Field Details

  • Constructor Details

    • VariableController

      public VariableController(EntityService entityService, Events events)
      Initializes the model controller and establish link to database Creator function that ensures that the model is connected to a document
  • Method Details

    • swapVariableOrder

      @PostMapping("/api/model/{modelId}/swapvariable/{variable1}/{variable2}") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<String> swapVariableOrder(@PathVariable("modelId") Model model, @PathVariable("variable1") Variable variable1, @PathVariable("variable2") Variable variable2, Principal principal)
    • createVariable

      @PostMapping("/api/model/{modelId}/area/{areaId}/subarea/{subAreaId}/variable") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<Long> createVariable(@PathVariable("modelId") Model model, @PathVariable("areaId") Area area, @PathVariable("subAreaId") SubArea subArea, @RequestBody @Valid @Valid VariableData variableData, Principal principal)
      Adds a variable to the @model
      Parameters:
      model - the model to add the variable to
      variableData - the data to be stored
      principal - the user logged in
      Returns:
      the id of the created variable
    • updateVariable

      @PutMapping("/api/model/{modelId}/area/{areaId}/subarea/{subAreaId}/variable/{variableId}") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<String> updateVariable(@PathVariable("modelId") Model model, @PathVariable("areaId") Area area, @PathVariable("subAreaId") SubArea subArea, @PathVariable("variableId") Variable existingVariable, @RequestBody @Valid @Valid VariableData variableData, Principal principal)
      Update a variable to the @model
      Parameters:
      model - the model to add the variable to
      variableData - the data to be stored
      principal - the user logged in
      Returns:
      the id of the created variable
    • deleteVariable

      @DeleteMapping("/api/model/{modelId}/area/{areaId}/subarea/{subAreaId}/variable/{variableId}") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<String> deleteVariable(@PathVariable("modelId") Model model, @PathVariable("areaId") Area area, @PathVariable("subAreaId") SubArea subArea, @PathVariable("variableId") Variable existingVariable, Principal principal)
      Safely deletes a variable from the @model
      Parameters:
      model - the model to add the variable to
      area - the area the variable is connected to
      subArea - the subArea the variable is connected to
      Returns:
      the id of the created variable
    • addVariableValue

      @PostMapping("/api/model/{modelId}/variable/{variableId}/value") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<Long> addVariableValue(@PathVariable("modelId") Model model, @PathVariable("variableId") Variable variable, @RequestBody @Valid @Valid VariableValueData variableValueData, Principal principal)
    • importVariableValues

      @PostMapping("/api/model/{modelId}/variablevalues/import") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<List<Long>> importVariableValues(@PathVariable("modelId") Model model, @RequestBody @Valid @Valid ImportVariableValueData importVariableValueData, Principal principal)
    • addOrUpdateVariableValues

      @PostMapping("/api/model/{modelId}/variablevalues") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<List<Long>> addOrUpdateVariableValues(@PathVariable("modelId") Model model, @RequestBody @Valid @Valid List<VariableValueData> variableValueDataList, Principal principal)
      Add or update variables values
      Parameters:
      model - the model to be updated sent by its model id
      variableValueDataList - a list of VariableValueData
      principal - the principal performing the action
      Returns:
      a list of created variableValueIDs
    • updateVariableValue

      @PutMapping("/api/model/{modelId}/variable/{variableId}/value/{variableValueId}") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<String> updateVariableValue(@PathVariable("modelId") Model model, @PathVariable("variableId") Variable variable, @PathVariable("variableValueId") VariableValue variableValue, @RequestBody @Valid @Valid VariableValueData variableValueData, Principal principal)
    • deleteCellValue

      @DeleteMapping("/api/model/{modelId}/variable/{variableId}/value/{variableValueId}") @PreAuthorize("authentication.principal.hasModelRole(#model,\'EDITOR\')") public org.springframework.http.ResponseEntity<String> deleteCellValue(@PathVariable("modelId") Model model, @PathVariable("variableId") Variable variable, @PathVariable("variableValueId") VariableValue variableValue, Principal principal)