
pro.taskana.common.rest.TaskanaEngineController Maven / Gradle / Ivy
The newest version!
package pro.taskana.common.rest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.config.EnableHypermediaSupport;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pro.taskana.TaskanaConfiguration;
import pro.taskana.common.api.ConfigurationService;
import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.security.CurrentUserContext;
import pro.taskana.common.rest.models.CustomAttributesRepresentationModel;
import pro.taskana.common.rest.models.TaskanaUserInfoRepresentationModel;
import pro.taskana.common.rest.models.VersionRepresentationModel;
/** Controller for TaskanaEngine related tasks. */
@RestController
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
public class TaskanaEngineController {
private final TaskanaConfiguration taskanaConfiguration;
private final TaskanaEngine taskanaEngine;
private final CurrentUserContext currentUserContext;
private final ConfigurationService configurationService;
@Autowired
TaskanaEngineController(
TaskanaConfiguration taskanaConfiguration,
TaskanaEngine taskanaEngine,
CurrentUserContext currentUserContext,
ConfigurationService configurationService) {
this.taskanaConfiguration = taskanaConfiguration;
this.taskanaEngine = taskanaEngine;
this.currentUserContext = currentUserContext;
this.configurationService = configurationService;
}
@Operation(
summary = "This endpoint retrieves all configured Domains.",
responses =
@ApiResponse(
responseCode = "200",
description = "An array with the domain-names as strings",
content =
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = String[].class))))
@GetMapping(path = RestEndpoints.URL_DOMAIN)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity> getDomains() {
return ResponseEntity.ok(taskanaConfiguration.getDomains());
}
@Operation(
summary =
"This endpoint retrieves the configured classification categories for a specific "
+ "classification type.",
parameters =
@Parameter(
name = "type",
description =
"The classification type whose categories should be determined. If not specified "
+ "all classification categories will be returned."),
responses =
@ApiResponse(
responseCode = "200",
description = "The classification categories for the requested type.",
content =
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = String[].class))))
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity> getClassificationCategories(
@RequestParam(value = "type", required = false) String type) {
if (type != null) {
return ResponseEntity.ok(taskanaConfiguration.getClassificationCategoriesByType(type));
}
return ResponseEntity.ok(taskanaConfiguration.getAllClassificationCategories());
}
@Operation(
summary = "This endpoint retrieves the configured classification types.",
responses =
@ApiResponse(
responseCode = "200",
description = "The configured classification types.",
content =
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = String[].class))))
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_TYPES)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity> getClassificationTypes() {
return ResponseEntity.ok(taskanaConfiguration.getClassificationTypes());
}
@Operation(
summary =
"This endpoint retrieves all configured classification categories grouped by each "
+ "classification type.",
responses =
@ApiResponse(
responseCode = "200",
description = "The configured classification categories.",
content =
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(ref = "#/components/schemas/TypeMapSchema"))))
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES_BY_TYPES)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity
© 2015 - 2025 Weber Informatics LLC | Privacy Policy