Adding common error api responses using composite annotations avoiding repeats and clearing controllers code
This commit is contained in:
parent
b7afdb59ad
commit
39704dd0b2
|
@ -16,6 +16,7 @@ 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.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import org.opencdmp.audit.AuditableAction;
|
||||
|
@ -24,6 +25,8 @@ import org.opencdmp.commons.enums.DmpAccessType;
|
|||
import org.opencdmp.commons.enums.DmpStatus;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.controllers.swagger.SwaggerHelpers;
|
||||
import org.opencdmp.controllers.swagger.annotation.Swagger404;
|
||||
import org.opencdmp.controllers.swagger.annotation.SwaggerErrorResponses;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.data.StorageFileEntity;
|
||||
import org.opencdmp.model.DescriptionValidationResult;
|
||||
|
@ -72,6 +75,7 @@ import static org.opencdmp.authorization.AuthorizationFlags.Public;
|
|||
@RestController
|
||||
@RequestMapping(path = "api/description")
|
||||
@Tag(name = "Descriptions", description = "Manage descriptions")
|
||||
@SwaggerErrorResponses
|
||||
public class DescriptionController {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionController.class));
|
||||
|
@ -166,7 +170,24 @@ public class DescriptionController {
|
|||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "OK",
|
||||
responseCode = "200",
|
||||
content = {
|
||||
@Content(
|
||||
examples = {
|
||||
@ExampleObject(
|
||||
name = "First page",
|
||||
description = "Example with the first page of paginated results",
|
||||
value = SwaggerHelpers.Description.endpoint_query_response_example
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
public QueryResult<Description> query(@RequestBody DescriptionLookup lookup) throws MyApplicationException, MyForbiddenException {
|
||||
logger.debug("querying {}", Description.class.getSimpleName());
|
||||
|
@ -183,6 +204,7 @@ public class DescriptionController {
|
|||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "Fetch a specific description by id")
|
||||
@Swagger404
|
||||
public Description get(
|
||||
@Parameter(name = "id", description = "The id of a description to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
@Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet
|
||||
|
@ -207,6 +229,7 @@ public class DescriptionController {
|
|||
|
||||
@PostMapping("persist")
|
||||
@Operation(summary = "Create a new or update an existing description")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = DescriptionPersist.DescriptionPersistValidator.ValidatorName, argumentName = "model")
|
||||
public Description persist(
|
||||
|
@ -228,6 +251,7 @@ public class DescriptionController {
|
|||
|
||||
@PostMapping("persist-status")
|
||||
@Operation(summary = "Update the status of an existing description")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = DescriptionStatusPersist.DescriptionStatusPersistValidator.ValidatorName, argumentName = "model")
|
||||
public Description persistStatus(
|
||||
|
@ -281,6 +305,7 @@ public class DescriptionController {
|
|||
|
||||
@DeleteMapping("{id}")
|
||||
@Operation(summary = "Delete a description by id")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
public void delete(
|
||||
@Parameter(name = "id", description = "The id of a description to delete", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id
|
||||
|
@ -294,6 +319,7 @@ public class DescriptionController {
|
|||
|
||||
@GetMapping("{id}/export/{type}")
|
||||
@Operation(summary = "Export a description in various formats by id")
|
||||
@Swagger404
|
||||
public ResponseEntity<byte[]> export(
|
||||
@Parameter(name = "id", description = "The id of a description to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
@Parameter(name = "type", description = "The type of the export", example = "rda", required = true) @PathVariable("type") String exportType
|
||||
|
@ -305,6 +331,7 @@ public class DescriptionController {
|
|||
|
||||
@PostMapping("field-file/upload")
|
||||
@Operation(summary = "Upload a file attachment on a field that supports it")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = DescriptionFieldFilePersist.PersistValidator.ValidatorName, argumentName = "model")
|
||||
public StorageFile uploadFieldFiles(
|
||||
|
@ -327,6 +354,7 @@ public class DescriptionController {
|
|||
|
||||
@GetMapping("{id}/field-file/{fileId}")
|
||||
@Operation(summary = "Fetch a field file attachment as byte array")
|
||||
@Swagger404
|
||||
public ResponseEntity<ByteArrayResource> getFieldFile(
|
||||
@Parameter(name = "id", description = "The id of a description", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
@Parameter(name = "fileIid", description = "The id of the file we want to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("fileId") UUID fileId
|
||||
|
@ -353,6 +381,7 @@ public class DescriptionController {
|
|||
|
||||
@PostMapping("update-description-template")
|
||||
@Operation(summary = "Change the template of a description")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = UpdateDescriptionTemplatePersist.UpdateDescriptionTemplatePersistValidator.ValidatorName, argumentName = "model")
|
||||
public Boolean updateDescriptionTemplate(@RequestBody UpdateDescriptionTemplatePersist model) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException {
|
||||
|
@ -368,6 +397,7 @@ public class DescriptionController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/xml/export/{id}", produces = "application/xml")
|
||||
@Operation(summary = "Export a description in xml format by id")
|
||||
@Swagger404
|
||||
public @ResponseBody ResponseEntity<byte[]> getXml(
|
||||
@Parameter(name = "id", description = "The id of a description to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable UUID id
|
||||
) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
||||
|
|
|
@ -25,6 +25,8 @@ import org.opencdmp.commons.enums.DmpAccessType;
|
|||
import org.opencdmp.commons.enums.DmpStatus;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.controllers.swagger.SwaggerHelpers;
|
||||
import org.opencdmp.controllers.swagger.annotation.Swagger404;
|
||||
import org.opencdmp.controllers.swagger.annotation.SwaggerErrorResponses;
|
||||
import org.opencdmp.model.DescriptionsToBeFinalized;
|
||||
import org.opencdmp.model.DmpUser;
|
||||
import org.opencdmp.model.DmpValidationResult;
|
||||
|
@ -66,6 +68,7 @@ import static org.opencdmp.authorization.AuthorizationFlags.Public;
|
|||
@RestController
|
||||
@RequestMapping(path = "api/dmp")
|
||||
@Tag(name = "Plans", description = "Manage plans")
|
||||
@SwaggerErrorResponses
|
||||
public class DmpController {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpController.class));
|
||||
|
@ -189,6 +192,7 @@ public class DmpController {
|
|||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "Fetch a specific plan by id")
|
||||
@Swagger404()
|
||||
public Dmp Get(
|
||||
@Parameter(name = "id", description = "The id of a plan to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
@Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet,
|
||||
|
@ -213,6 +217,7 @@ public class DmpController {
|
|||
|
||||
@PostMapping("persist")
|
||||
@Operation(summary = "Create a new or update an existing plan")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = DmpPersist.DmpPersistValidator.ValidatorName, argumentName = "model")
|
||||
public Dmp Persist(
|
||||
|
@ -233,6 +238,7 @@ public class DmpController {
|
|||
|
||||
@DeleteMapping("{id}")
|
||||
@Operation(summary = "Delete a plan by id")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
public void Delete(
|
||||
@Parameter(name = "id", description = "The id of a plan to delete", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id
|
||||
|
@ -246,6 +252,7 @@ public class DmpController {
|
|||
|
||||
@PostMapping("finalize/{id}")
|
||||
@Operation(summary = "Finalize a plan by id")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
public boolean finalize(
|
||||
@Parameter(name = "id", description = "The id of a plan to finalize", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
|
@ -265,6 +272,7 @@ public class DmpController {
|
|||
|
||||
@GetMapping("undo-finalize/{id}")
|
||||
@Operation(summary = "Undo the finalization of a plan by id (only possible if it is not already deposited)")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
public boolean undoFinalize(
|
||||
@Parameter(name = "id", description = "The id of a plan to revert the finalization", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
|
@ -302,6 +310,7 @@ public class DmpController {
|
|||
|
||||
@PostMapping("clone")
|
||||
@Operation(summary = "Create a clone of an existing plan")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = CloneDmpPersist.CloneDmpPersistValidator.ValidatorName, argumentName = "model")
|
||||
public Dmp buildClone(
|
||||
|
@ -324,6 +333,7 @@ public class DmpController {
|
|||
|
||||
@PostMapping("new-version")
|
||||
@Operation(summary = "Create a new version of an existing plan")
|
||||
@Swagger404
|
||||
@Transactional
|
||||
@ValidationFilterAnnotation(validator = NewVersionDmpPersist.NewVersionDmpPersistValidator.ValidatorName, argumentName = "model")
|
||||
public Dmp createNewVersion(
|
||||
|
@ -380,6 +390,7 @@ public class DmpController {
|
|||
|
||||
@GetMapping("{id}/export/{transformerId}/{type}")
|
||||
@Operation(summary = "Export a plan in various formats by id")
|
||||
@Swagger404
|
||||
public ResponseEntity<byte[]> export(
|
||||
@Parameter(name = "id", description = "The id of a plan to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id,
|
||||
@PathVariable("transformerId") String transformerId,
|
||||
|
@ -431,6 +442,7 @@ public class DmpController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/xml/export/{id}", produces = "application/xml")
|
||||
@Operation(summary = "Export a plan in xml format by id")
|
||||
@Swagger404
|
||||
public @ResponseBody ResponseEntity<byte[]> getXml(
|
||||
@Parameter(name = "id", description = "The id of a plan to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable UUID id
|
||||
) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
||||
|
|
|
@ -3,13 +3,42 @@ package org.opencdmp.controllers.swagger;
|
|||
public class SwaggerHelpers {
|
||||
|
||||
public static class Commons {
|
||||
|
||||
public static final String fieldset_description =
|
||||
"""
|
||||
This is an object containing a list of the properties you wish to include in the response, similar to the 'project' attribute on queries.
|
||||
""";
|
||||
}
|
||||
|
||||
public static class Errors {
|
||||
|
||||
public static final String message_403 =
|
||||
"""
|
||||
{
|
||||
"code": 403
|
||||
"message" null
|
||||
}
|
||||
""";
|
||||
|
||||
public static final String message_404 =
|
||||
"""
|
||||
{
|
||||
"code": 404,
|
||||
"message": "Item {0} of type {1} not found"
|
||||
}
|
||||
""";
|
||||
|
||||
public static final String message_500 =
|
||||
"""
|
||||
{
|
||||
"error": "System error"
|
||||
}
|
||||
""";
|
||||
|
||||
}
|
||||
|
||||
public static class Dmp {
|
||||
|
||||
public static final String endpoint_query =
|
||||
"""
|
||||
This endpoint is used to fetch all the available plans.<br/>
|
||||
|
@ -868,6 +897,7 @@ public class SwaggerHelpers {
|
|||
}
|
||||
|
||||
public static class Description {
|
||||
|
||||
public static final String endpoint_query =
|
||||
"""
|
||||
This endpoint is used to fetch all the available descriptions.<br/>
|
||||
|
@ -1038,9 +1068,686 @@ public class SwaggerHelpers {
|
|||
}
|
||||
""";
|
||||
|
||||
public static final String endpoint_get =
|
||||
public static final String endpoint_query_response_example =
|
||||
"""
|
||||
|
||||
{
|
||||
"items":[
|
||||
{
|
||||
"id":"a18258c6-8a47-4716-81f3-9cbe383af182",
|
||||
"label":"delete template",
|
||||
"status":0,
|
||||
"updatedAt":"2024-06-06T13:15:15.763826Z",
|
||||
"dmpDescriptionTemplate":{
|
||||
"id":"29a3385c-a2ae-4675-b1c6-0fd5a49017be",
|
||||
"dmp":{
|
||||
"id":"9dcb614e-05c5-4679-bbe8-7cb8913586e8"
|
||||
},
|
||||
"sectionId":"0db7845b-0e7c-41df-8d91-cbca97995fd5",
|
||||
"descriptionTemplateGroupId":"f0979866-f9d1-4eb3-b33e-572e744ce8af"
|
||||
},
|
||||
"descriptionTemplate":{
|
||||
"id":"2ea4c926-df57-48fa-b22d-2b2bafae1267",
|
||||
"label":"delete",
|
||||
"groupId":"f0979866-f9d1-4eb3-b33e-572e744ce8af"
|
||||
},
|
||||
"authorizationFlags":[
|
||||
"DeleteDescription",
|
||||
"EditDescription",
|
||||
"InviteDmpUsers"
|
||||
],
|
||||
"dmp":{
|
||||
"id":"9dcb614e-05c5-4679-bbe8-7cb8913586e8",
|
||||
"label":"description template delete plan",
|
||||
"status":0,
|
||||
"blueprint":{
|
||||
"id":"86635178-36a6-484f-9057-a934e4eeecd5",
|
||||
"label":"Dmp Default Blueprint",
|
||||
"definition":{
|
||||
"sections":[
|
||||
{
|
||||
"id":"f94e50e0-cb97-4c65-8b88-e5db6badd41d",
|
||||
"label":"Main Info",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"3c2608e5-9320-4d94-9ed7-1eab9500d84b",
|
||||
"label":"Funding",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"2a77e1f6-9989-4aeb-acd9-48e911a92abd",
|
||||
"label":"License",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"0db7845b-0e7c-41df-8d91-cbca97995fd5",
|
||||
"label":"Templates",
|
||||
"hasTemplates":true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dmpUsers":[
|
||||
{
|
||||
"id":"cbd64e90-846e-4c4e-8678-89ebc54b1c5f",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"e60876ed-87f8-4a8e-8081-e5620ec839cf"
|
||||
},
|
||||
"role":0,
|
||||
"isActive":1
|
||||
}
|
||||
]
|
||||
},
|
||||
"belongsToCurrentTenant":true
|
||||
},
|
||||
{
|
||||
"id":"46c9be1b-9809-4bd3-b730-ce4a9b457484",
|
||||
"label":"description from default",
|
||||
"status":0,
|
||||
"updatedAt":"2024-06-06T12:56:33.171675Z",
|
||||
"dmpDescriptionTemplate":{
|
||||
"id":"69ea7b42-e5e4-4b23-b17d-9883ece3ee53",
|
||||
"dmp":{
|
||||
"id":"703b00d0-af49-4e5a-9002-fc3f4ae6e107"
|
||||
},
|
||||
"sectionId":"0db7845b-0e7c-41df-8d91-cbca97995fd5",
|
||||
"descriptionTemplateGroupId":"11559a4f-d6f4-4dc9-8e6b-d1879700ac12"
|
||||
},
|
||||
"descriptionTemplate":{
|
||||
"id":"57ced1f1-6e8c-482a-88c4-2e2d6322b25c",
|
||||
"label":"Academy Of Finland",
|
||||
"groupId":"11559a4f-d6f4-4dc9-8e6b-d1879700ac12"
|
||||
},
|
||||
"authorizationFlags":[
|
||||
"DeleteDescription",
|
||||
"EditDescription",
|
||||
"InviteDmpUsers"
|
||||
],
|
||||
"dmp":{
|
||||
"id":"703b00d0-af49-4e5a-9002-fc3f4ae6e107",
|
||||
"label":"plan from default",
|
||||
"status":0,
|
||||
"blueprint":{
|
||||
"id":"86635178-36a6-484f-9057-a934e4eeecd5",
|
||||
"label":"Dmp Default Blueprint",
|
||||
"definition":{
|
||||
"sections":[
|
||||
{
|
||||
"id":"f94e50e0-cb97-4c65-8b88-e5db6badd41d",
|
||||
"label":"Main Info",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"3c2608e5-9320-4d94-9ed7-1eab9500d84b",
|
||||
"label":"Funding",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"2a77e1f6-9989-4aeb-acd9-48e911a92abd",
|
||||
"label":"License",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"0db7845b-0e7c-41df-8d91-cbca97995fd5",
|
||||
"label":"Templates",
|
||||
"hasTemplates":true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dmpUsers":[
|
||||
{
|
||||
"id":"dff384f8-3e06-47b9-84f9-b91b66ab3327",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"e60876ed-87f8-4a8e-8081-e5620ec839cf"
|
||||
},
|
||||
"role":0,
|
||||
"isActive":1
|
||||
}
|
||||
]
|
||||
},
|
||||
"belongsToCurrentTenant":true
|
||||
},
|
||||
{
|
||||
"id":"546a6195-17b6-4d1e-bad2-fa322fbad3f1",
|
||||
"label":"user3 description - to delete",
|
||||
"status":0,
|
||||
"updatedAt":"2024-06-06T09:58:17.507386Z",
|
||||
"dmpDescriptionTemplate":{
|
||||
"id":"0e8a5e65-c3bc-49b0-a6f3-d7da22836f3b",
|
||||
"dmp":{
|
||||
"id":"f2e807f1-7fd4-48db-b781-e9c972057447"
|
||||
},
|
||||
"sectionId":"44e6e93b-a6e0-6036-bda5-b33fe1df2f02",
|
||||
"descriptionTemplateGroupId":"33dc4612-32bf-46a3-b040-12e32a06b3c7"
|
||||
},
|
||||
"descriptionTemplate":{
|
||||
"id":"d8a1ac10-ffa4-4f7f-afe9-36b904af4ae7",
|
||||
"label":"RDA_madmp-only new TO DELETE ",
|
||||
"groupId":"33dc4612-32bf-46a3-b040-12e32a06b3c7"
|
||||
},
|
||||
"authorizationFlags":[
|
||||
"DeleteDescription",
|
||||
"EditDescription",
|
||||
"InviteDmpUsers"
|
||||
],
|
||||
"dmp":{
|
||||
"id":"f2e807f1-7fd4-48db-b781-e9c972057447",
|
||||
"label":"user3 plan",
|
||||
"status":0,
|
||||
"blueprint":{
|
||||
"id":"fc83c102-8c3c-4298-8e64-02bdd0fb7275",
|
||||
"label":"blueprint with users",
|
||||
"definition":{
|
||||
"sections":[
|
||||
{
|
||||
"id":"44e6e93b-a6e0-6036-bda5-b33fe1df2f02",
|
||||
"label":"Main info",
|
||||
"hasTemplates":true
|
||||
},
|
||||
{
|
||||
"id":"109ceb1e-9703-2a03-462b-8bf93f993a53",
|
||||
"label":"Section2",
|
||||
"hasTemplates":true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dmpUsers":[
|
||||
{
|
||||
"id":"fcce59eb-8e9e-4768-92fe-e772886836f2",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"7d6e54b6-31e8-48df-9c3f-1e5b3eb48404"
|
||||
},
|
||||
"role":0,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"8f698ad7-69e4-4fcf-b9b3-563b1b05ac45",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"0b26b2eb-5346-463c-b0f4-fa22d9a4c964",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"5154ec6e-912d-4b4f-8f1e-cc2a34069344",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":1,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"9ec5f356-43a3-462d-bbf2-27476931892f",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":1,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"e4e6a68c-408e-47fa-8b40-cb8c155f9eda",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"f1de4a02-137f-48d9-bd31-5904b2ba504a",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"9e444526-94c4-4e50-9c35-adf73fab5f8c",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"c92686d2-b434-44e3-b8fb-ef0d6a30582d",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"42f9c224-8704-4c41-8a2d-71b5c78d7690",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"be5836f4-842a-4a74-b852-c4bb4212adb0",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"18bb660a-638c-4def-90da-0c83368f7c1e",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"e5a8f9d1-30a3-4ee0-8ca6-f74c5e73ba53",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":1
|
||||
}
|
||||
]
|
||||
},
|
||||
"belongsToCurrentTenant":true
|
||||
},
|
||||
{
|
||||
"id":"49b4c2df-0bad-4173-85d4-c5b416a7125a",
|
||||
"label":"user3 description",
|
||||
"status":0,
|
||||
"updatedAt":"2024-06-05T14:43:20.353594Z",
|
||||
"dmpDescriptionTemplate":{
|
||||
"id":"3432e0b5-fbda-4a81-ab56-06657636da57",
|
||||
"dmp":{
|
||||
"id":"f2e807f1-7fd4-48db-b781-e9c972057447"
|
||||
},
|
||||
"sectionId":"44e6e93b-a6e0-6036-bda5-b33fe1df2f02",
|
||||
"descriptionTemplateGroupId":"11559a4f-d6f4-4dc9-8e6b-d1879700ac12"
|
||||
},
|
||||
"descriptionTemplate":{
|
||||
"id":"57ced1f1-6e8c-482a-88c4-2e2d6322b25c",
|
||||
"label":"Academy Of Finland",
|
||||
"groupId":"11559a4f-d6f4-4dc9-8e6b-d1879700ac12"
|
||||
},
|
||||
"authorizationFlags":[
|
||||
"DeleteDescription",
|
||||
"EditDescription",
|
||||
"InviteDmpUsers"
|
||||
],
|
||||
"dmp":{
|
||||
"id":"f2e807f1-7fd4-48db-b781-e9c972057447",
|
||||
"label":"user3 plan",
|
||||
"status":0,
|
||||
"blueprint":{
|
||||
"id":"fc83c102-8c3c-4298-8e64-02bdd0fb7275",
|
||||
"label":"blueprint with users",
|
||||
"definition":{
|
||||
"sections":[
|
||||
{
|
||||
"id":"44e6e93b-a6e0-6036-bda5-b33fe1df2f02",
|
||||
"label":"Main info",
|
||||
"hasTemplates":true
|
||||
},
|
||||
{
|
||||
"id":"109ceb1e-9703-2a03-462b-8bf93f993a53",
|
||||
"label":"Section2",
|
||||
"hasTemplates":true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dmpUsers":[
|
||||
{
|
||||
"id":"fcce59eb-8e9e-4768-92fe-e772886836f2",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"7d6e54b6-31e8-48df-9c3f-1e5b3eb48404"
|
||||
},
|
||||
"role":0,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"8f698ad7-69e4-4fcf-b9b3-563b1b05ac45",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"0b26b2eb-5346-463c-b0f4-fa22d9a4c964",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"5154ec6e-912d-4b4f-8f1e-cc2a34069344",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":1,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"9ec5f356-43a3-462d-bbf2-27476931892f",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":1,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"e4e6a68c-408e-47fa-8b40-cb8c155f9eda",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"f1de4a02-137f-48d9-bd31-5904b2ba504a",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"9e444526-94c4-4e50-9c35-adf73fab5f8c",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"c92686d2-b434-44e3-b8fb-ef0d6a30582d",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":3,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"42f9c224-8704-4c41-8a2d-71b5c78d7690",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"be5836f4-842a-4a74-b852-c4bb4212adb0",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":0
|
||||
},
|
||||
{
|
||||
"id":"18bb660a-638c-4def-90da-0c83368f7c1e",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"e5a8f9d1-30a3-4ee0-8ca6-f74c5e73ba53",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":2,
|
||||
"isActive":1
|
||||
}
|
||||
]
|
||||
},
|
||||
"belongsToCurrentTenant":true
|
||||
},
|
||||
{
|
||||
"id":"9ac982e6-1cdd-4e03-b083-e91911114cc7",
|
||||
"label":"test",
|
||||
"status":0,
|
||||
"updatedAt":"2024-06-05T13:54:15.215978Z",
|
||||
"dmpDescriptionTemplate":{
|
||||
"id":"af011eaf-211c-40f5-af02-66a86912349a",
|
||||
"dmp":{
|
||||
"id":"c5c9b67f-3c27-4677-900a-1f6f799f2bc9"
|
||||
},
|
||||
"sectionId":"0db7845b-0e7c-41df-8d91-cbca97995fd5",
|
||||
"descriptionTemplateGroupId":"11559a4f-d6f4-4dc9-8e6b-d1879700ac12"
|
||||
},
|
||||
"descriptionTemplate":{
|
||||
"id":"57ced1f1-6e8c-482a-88c4-2e2d6322b25c",
|
||||
"label":"Academy Of Finland",
|
||||
"groupId":"11559a4f-d6f4-4dc9-8e6b-d1879700ac12"
|
||||
},
|
||||
"authorizationFlags":[
|
||||
"DeleteDescription",
|
||||
"EditDescription",
|
||||
"InviteDmpUsers"
|
||||
],
|
||||
"dmp":{
|
||||
"id":"c5c9b67f-3c27-4677-900a-1f6f799f2bc9",
|
||||
"label":"test export contact",
|
||||
"status":0,
|
||||
"accessType":1,
|
||||
"blueprint":{
|
||||
"id":"86635178-36a6-484f-9057-a934e4eeecd5",
|
||||
"label":"Dmp Default Blueprint",
|
||||
"definition":{
|
||||
"sections":[
|
||||
{
|
||||
"id":"f94e50e0-cb97-4c65-8b88-e5db6badd41d",
|
||||
"label":"Main Info",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"3c2608e5-9320-4d94-9ed7-1eab9500d84b",
|
||||
"label":"Funding",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"2a77e1f6-9989-4aeb-acd9-48e911a92abd",
|
||||
"label":"License",
|
||||
"hasTemplates":false
|
||||
},
|
||||
{
|
||||
"id":"0db7845b-0e7c-41df-8d91-cbca97995fd5",
|
||||
"label":"Templates",
|
||||
"hasTemplates":true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dmpReferences":[
|
||||
{
|
||||
"id":"f74eca5b-f865-440d-b888-7ebe8482290a",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"reference":{
|
||||
"id":"ab7a87f2-69bb-4b14-94fc-6b65d822a8b2",
|
||||
"label":"Archiv der Deutschen Frauenbewegung",
|
||||
"type":{
|
||||
"id":"7eeffb98-58fb-4921-82ec-e27f32f8e738"
|
||||
},
|
||||
"reference":"pending_org_::44714f780f925d981f99b085346d1e2a"
|
||||
},
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"09e66ee1-4b29-4195-9a9b-f931af1b093f",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"reference":{
|
||||
"id":"8ea5ff4d-4a0a-4baa-8dc1-7f1de31bc3e2",
|
||||
"label":"Aisha Mohammed (0000-0002-0131-1543)",
|
||||
"type":{
|
||||
"id":"5a2112e7-ea99-4cfe-98a1-68665e26726e"
|
||||
},
|
||||
"reference":"0000-0002-0131-1543"
|
||||
},
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"ffdfec53-2a53-4953-a977-76149bc269af",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"reference":{
|
||||
"id":"7aed6061-39a9-4a86-944b-f7c49024ccfc",
|
||||
"label":"Autonomously Assembling Nanomaterial Scaffolds for Treating Myocardial Infarction (nih_________::5R01HL117326-03)",
|
||||
"type":{
|
||||
"id":"5b9c284f-f041-4995-96cc-fad7ad13289c"
|
||||
},
|
||||
"reference":"nih_________::5R01HL117326-03"
|
||||
},
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"48877b47-fd2b-42f7-b7f0-bc6a379f0971",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"reference":{
|
||||
"id":"98435709-ccc6-42c7-aa96-30b7e4d8f317",
|
||||
"label":"ADAPT - Centre for Digital Content Technology||",
|
||||
"type":{
|
||||
"id":"538928bb-c7c6-452e-b66d-08e539f5f082"
|
||||
},
|
||||
"reference":"501100014826::501100014826||ADAPT - Centre for Digital Content Technology||"
|
||||
},
|
||||
"isActive":1
|
||||
}
|
||||
],
|
||||
"dmpUsers":[
|
||||
{
|
||||
"id":"bcf92d98-1492-4423-b1a2-2b1ef76ea25e",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"391252ba-926d-4bf9-8c28-a921036f6c39"
|
||||
},
|
||||
"role":0,
|
||||
"isActive":1
|
||||
},
|
||||
{
|
||||
"id":"8caa96de-82f7-4593-b0f6-7e88cfe76530",
|
||||
"dmp":{
|
||||
\s
|
||||
},
|
||||
"user":{
|
||||
"id":"7d6e54b6-31e8-48df-9c3f-1e5b3eb48404"
|
||||
},
|
||||
"role":0,
|
||||
"isActive":1
|
||||
}
|
||||
]
|
||||
},
|
||||
"belongsToCurrentTenant":true
|
||||
}
|
||||
],
|
||||
"count":4006
|
||||
}
|
||||
""";
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package org.opencdmp.controllers.swagger.annotation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
import static org.opencdmp.controllers.swagger.SwaggerHelpers.Errors.message_403;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
|
||||
@ApiResponse(
|
||||
description = "This is generally the response you should expect when you don't have sufficient permissions to perform an action.",
|
||||
responseCode = "403",
|
||||
content = {
|
||||
@Content(
|
||||
examples = {
|
||||
@ExampleObject(
|
||||
name = "404 response",
|
||||
description = "This is the response in case of a 403 error.",
|
||||
value = message_403
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
public @interface Swagger403 {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.opencdmp.controllers.swagger.annotation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
import static org.opencdmp.controllers.swagger.SwaggerHelpers.Errors.message_404;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
|
||||
@ApiResponse(
|
||||
description = "This is generally the response you should expect when an entity is not found or you don't have sufficient permissions to view it.",
|
||||
responseCode = "404",
|
||||
content = {
|
||||
@Content(
|
||||
examples = {
|
||||
@ExampleObject(
|
||||
name = "404 response",
|
||||
description = "This is the response in case of a 404 error where the first placeholder {0} will be replaced by the item id and the second one {1} by the item type.",
|
||||
value = message_404
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
public @interface Swagger404 {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.opencdmp.controllers.swagger.annotation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
import static org.opencdmp.controllers.swagger.SwaggerHelpers.Errors.message_500;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.FIELD})
|
||||
@ApiResponse(
|
||||
description = "This is the response you should expect when an unexpected exception has occurred.",
|
||||
responseCode = "500",
|
||||
content = {
|
||||
@Content(
|
||||
examples = {
|
||||
@ExampleObject(
|
||||
name = "500 response",
|
||||
description = "This is the response in case of an internal server error.",
|
||||
value = message_500
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
public @interface Swagger500 {
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.opencdmp.controllers.swagger.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
|
||||
@Swagger500
|
||||
@Swagger403
|
||||
public @interface SwaggerErrorResponses {
|
||||
|
||||
}
|
Loading…
Reference in New Issue