Commit ccbaa52d authored by naji's avatar naji
Browse files

Docs: add tags, summary and descriptions

parent 09cfae29
/*
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
[dad@cines.fr]
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
profiles based on the french SEDA standard
(https://redirect.francearchives.fr/seda/).
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
......@@ -28,9 +28,9 @@ that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
......@@ -54,6 +54,9 @@ import fr.gouv.vitamui.pastis.util.pua.NoticeFromPUA;
import fr.gouv.vitamui.pastis.util.pua.PuaFromJSON;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.servers.Server;
import io.swagger.v3.oas.annotations.servers.ServerVariable;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONObject;
......@@ -86,7 +89,14 @@ import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
@OpenAPIDefinition(tags = @Tag(name="pastis"))
@OpenAPIDefinition(tags = { @Tag(name = "pastis"),@Tag(name="test") },
info = @Info(title = "Pastis Rest Api", description = ""),
servers = { @Server(url = "dev.vitamui.com" ,
variables = { @ServerVariable(name = "scheme", allowableValues = {"https", "http"}, defaultValue = "https"),
@ServerVariable(name = "port", description = "Api port",defaultValue = "8051")})
, @Server(url = "localhost" ,
variables = { @ServerVariable(name = "scheme", allowableValues ={"https", "http"}, defaultValue = "http"),
@ServerVariable(name = "port", description = "Api port", defaultValue = "8051")}) })
@RestController
class ProfileController {
......@@ -119,12 +129,17 @@ class ProfileController {
private List<PastisProfile> pastisProfiles = new ArrayList<>();
@Operation(summary = "method for test Api is running",
description = "method for test Api is running",
tags = {"test"})
@RequestMapping(value = "/test", method = RequestMethod.GET)
String test() {
return "Pastis API is listening...";
}
@Operation(summary = "Retrieve RNG representation of the JSON structure")
@Operation(summary = "Retrieve RNG representation of the JSON structure",
description = "Retrieve RNG representation of the JSON structure of archive profile",
tags = {"pastis"})
@RequestMapping(value = "/getarchiveprofile", method = RequestMethod.POST, consumes = APPLICATION_JSON_UTF8, produces = MediaType.APPLICATION_XML_VALUE)
String getArchiveProfile(@RequestBody final ElementProperties json) throws IOException {
......@@ -165,14 +180,17 @@ class ProfileController {
return response;
}
@Operation(summary = "Retrieve JSON representation of archive unit profile",
description = "Retrieve JSON representation of archive unit profile",
tags = {"pastis"})
@RequestMapping(value = "/getarchiveunitprofile", method = RequestMethod.POST, consumes = APPLICATION_JSON_UTF8, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<String> getArchiveUnitProfile(@RequestBody final ProfileNotice json) throws IOException {
Notice notice = new Notice();
if(json.getNotice() != null){
notice = json.getNotice();
} else {
notice.set_id("12133411121213");
} else {
notice.set_id("12133411121213");
}
String controlSchema = puaFromJSON.getControlSchemaFromElementProperties(json.getElementProperties());
......@@ -185,6 +203,9 @@ class ProfileController {
}
@Operation(summary = "Retrieve JSON representation of the RNG structure",
description = "Retrieve JSON representation of the RNG structure",
tags = {"pastis"})
@RequestMapping (value = "/createprofile", method = RequestMethod.GET)
ResponseEntity<String> createprofile() throws URISyntaxException {
PastisSAX2Handler handler = new PastisSAX2Handler();
......@@ -208,6 +229,9 @@ class ProfileController {
return ResponseEntity.ok(getJson.getJsonParsedTree(handler.elementRNGRoot));
}
@Operation(summary = "Load Profile",
description = "Load profile by Id",
tags = {"pastis"})
@RequestMapping (value = "/edit", method = RequestMethod.POST)
ResponseEntity<String> loadProfile(@RequestParam(name = "id") String id) throws JsonProcessingException {
PastisSAX2Handler handler = new PastisSAX2Handler();
......@@ -256,7 +280,9 @@ class ProfileController {
return ResponseEntity.ok(response.toString());
}
@Operation(summary = "Upload profile PA or PUA",
description = "Upload profile PA or PUA",
tags = {"pastis"})
@RequestMapping (value = "/new", method = RequestMethod.POST,
consumes = "multipart/form-data", produces = "application/json")
ResponseEntity<String> loadProfileFromFile(@RequestParam MultipartFile file) {
......@@ -306,7 +332,9 @@ class ProfileController {
return ResponseEntity.ok(response.toString());
}
@Operation(summary = "Generate Json Struct from RNG file",
description = "Generate Json Struct from RNG file",
tags = {"pastis"})
@RequestMapping (value = "/createprofilefromfile",
method = RequestMethod.POST,consumes = "multipart/form-data",
produces = "application/json")
......@@ -332,6 +360,9 @@ class ProfileController {
return ResponseEntity.ok(getJson.getJsonParsedTree(handler.elementRNGRoot));
}
@Operation(summary = "Retrieve all profiles PA and PUA",
description = "Retrieve all profiles PA and PUA",
tags = {"pastis"})
@RequestMapping (value = "/getprofiles", method = RequestMethod.GET)
ResponseEntity<List<PastisProfile>> getFiles() throws IOException {
Resource[] resources = ResourcePatternUtils
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment