77import de .symeda .sormas .api .person .PersonQuarantineEndDto ;
88import de .symeda .sormas .api .person .PersonSymptomJournalStatusDto ;
99import de .symeda .sormas .api .visit .ExternalVisitDto ;
10+ import io .swagger .v3 .oas .annotations .Operation ;
11+ import io .swagger .v3 .oas .annotations .Parameter ;
12+ import io .swagger .v3 .oas .annotations .enums .ParameterIn ;
13+ import io .swagger .v3 .oas .annotations .media .Content ;
14+ import io .swagger .v3 .oas .annotations .media .Schema ;
15+ import io .swagger .v3 .oas .annotations .parameters .RequestBody ;
16+ import io .swagger .v3 .oas .annotations .responses .ApiResponse ;
1017
1118import javax .annotation .security .RolesAllowed ;
1219import javax .ws .rs .Consumes ;
1522import javax .ws .rs .Path ;
1623import javax .ws .rs .PathParam ;
1724import javax .ws .rs .Produces ;
25+ import javax .ws .rs .QueryParam ;
1826import javax .ws .rs .core .MediaType ;
1927import java .util .Date ;
2028import java .util .List ;
@@ -29,18 +37,82 @@ public class ExternalVisitsResource extends EntityDtoResource {
2937
3038 @ GET
3139 @ Path ("/person/{personUuid}" )
40+ @ Operation (summary = "Get person information" , description = "Get some personal data for a specific person" )
41+ @ Parameter (in = ParameterIn .PATH ,
42+ name = "personUuid" ,
43+ required = true ,
44+ description = "The Uuid of the person data is required for." ,
45+ schema = @ Schema (type = "string" ,
46+ format = "Uuid" ,
47+ example = "UO2OCI-BPXSAO-7Q4RHO-RMXCKC4M, where this is a personUuid that exists in your system." ))
48+ @ ApiResponse (
49+ description = "A selection of personal data, including first and last name, e-mail, phone number(s) and birth date if available"
50+ + "for that person. Note that Null value fields may not be returned. If you get an unexpected result, it might help to verify"
51+ + "if the personUuid is existing in your system via the isValid controller." ,
52+ content = @ Content (mediaType = "application/json" ,
53+ //@formatter:off
54+ schema = @ Schema (example = "[" +
55+ " {" +
56+ " \" uuid\" : \" UO2OCI-BPXSAO-7Q4RHO-RMXCKC4M\" ," +
57+ " \" pseudonymized\" : false," +
58+ " \" firstName\" : \" Tim\" ," +
59+ " \" lastName\" : \" Tahler\" ," +
60+ " \" sex\" : \" MALE\" ," +
61+ " \" birthdateDD\" : 6," +
62+ " \" birthdateMM\" : 4," +
63+ " \" birthdateYYYY\" : 1974," +
64+ " \" phone\" : \" 0123456789\" ," +
65+ " \" emailAddress\" : \" [email protected] \" " +
66+ " }" +
67+ "]" )))
68+ //@formatter:off
3269 public PersonDto getPersonByUuid (@ PathParam ("personUuid" ) String personUuid ) {
3370 return FacadeProvider .getPersonFacade ().getPersonForJournal (personUuid );
3471 };
3572
3673 @ GET
3774 @ Path ("/person/{personUuid}/isValid" )
75+ @ Operation (summary = "Check person validity" ,
76+ responses = {
77+ @ ApiResponse (responseCode = "true" , description = "If a person with the given Uuid exists in SORMAS." ),
78+ @ ApiResponse (responseCode = "false" , description = "Otherwise" ) })
79+ @ Parameter (in = ParameterIn .PATH ,
80+ name = "personUuid" ,
81+ required = true ,
82+ description = "The Uuid of the person data is required for." ,
83+ schema = @ Schema (type = "string" ,
84+ format = "Uuid" ,
85+ example = "UO2OCI-BPXSAO-7Q4RHO-RMXCKC4M, where this is a personUuid that exists in your system." ))
3886 public Boolean isValidPersonUuid (@ PathParam ("personUuid" ) String personUuid ) {
3987 return FacadeProvider .getPersonFacade ().isValidPersonUuid (personUuid );
4088 }
4189
90+ //@formatter:off
4291 @ POST
4392 @ Path ("/person/{personUuid}/status" )
93+ @ Operation (summary = "Save symptom journal status" ,
94+ responses = {
95+ @ ApiResponse (responseCode = "true" , description = "If the status was set succesfully." ),
96+ @ ApiResponse (responseCode = "false" , description = "Otherwise." ) })
97+ @ Parameter (in = ParameterIn .PATH ,
98+ name = "personUuid" ,
99+ required = true ,
100+ description = "The Uuid of the person data is posted for." ,
101+ schema = @ Schema (type = "string" ,
102+ format = "Uuid" ,
103+ example = "UO2OCI-BPXSAO-7Q4RHO-RMXCKC4M, where this is a personUuid that exists in your system." ))
104+ @ RequestBody (
105+ //@formatter:off
106+ description = "status may be one of the following:<br/>" +
107+ "UNREGISTERED: User has not yet sent any state<br/>" +
108+ "REGISTERED: After succesfull registration in SymptomJournal<br/>" +
109+ "ACCEPTED: User has accepted a confirmation<br/>" +
110+ "REJECTED: User has rejected (declined) a confirmation<br/>" +
111+ "DELETED: User was deleted" ,
112+ //@formatter:on
113+ content = @ Content (schema = @ Schema (example = "[\n {\n \" status\" : \" REGISTERED\" ,\n "
114+ + " \" statusDateTime\" : \" 2020-04-15T12:55:00.000+02:00\" // datetime format yyyy-MM-dd'T'HH:mm:ss.SSSZ\n }\n ]" )))
115+ //@formatter:on
44116 public boolean postSymptomJournalStatus (@ PathParam ("personUuid" ) String personUuid , PersonSymptomJournalStatusDto statusDto ) {
45117 try {
46118 return FacadeProvider .getPersonFacade ().setSymptomJournalStatus (personUuid , statusDto .getStatus ());
@@ -51,13 +123,20 @@ public boolean postSymptomJournalStatus(@PathParam("personUuid") String personUu
51123
52124 @ POST
53125 @ Path ("/" )
126+ @ Operation (summary = "Save visits" ,
127+ responses = {
128+ @ ApiResponse (responseCode = "OK" , description = "Visit saved successfully." ),
129+ @ ApiResponse (responseCode = "ERROR" , description = "Otherwise." ) })
54130 public List <PushResult > postExternalVisits (List <ExternalVisitDto > dtos ) {
55131 List <PushResult > result = savePushedDto (dtos , FacadeProvider .getVisitFacade ()::saveExternalVisit );
56132 return result ;
57133 }
58134
59135 @ GET
60136 @ Path ("/version" )
137+ @ Operation (summary = "Get API version" )
138+ @ ApiResponse (description = "The minimal version needed for compatibility with the external ReST API of SORMAS." ,
139+ content = @ Content (schema = @ Schema (type = "String" , example = "1.37.0" )))
61140 public String getVersion () {
62141 return EXTERNAL_VISITS_API_VERSION ;
63142 }
@@ -70,6 +149,26 @@ public List<PersonQuarantineEndDto> getLatestQuarantineEndDates(@PathParam("sinc
70149
71150 @ GET
72151 @ Path ("/followUpEndDates/{since}" )
152+ @ Operation (summary = "Get follow up end dates" ,
153+ description = "Get latest follow up end date assigned to the specified person. "
154+ + "Note: Only returns values for persons who have their symptom journal status set to ACCEPTED!" )
155+ @ Parameter (in = ParameterIn .PATH ,
156+ description = "Only data changed after this value is returned." ,
157+ name = "since" ,
158+ schema = @ Schema (format = "UNIX timestamp [Long)" ))
159+ //@formatter:off
160+ @ ApiResponse (content = @ Content (schema = @ Schema (example = "[\n " +
161+ " {\n " +
162+ " \" personUuid\" : \" Q56VFD-G3TXKT-R2DBIW-FTWIKAMI\" ,\n " +
163+ " \" latestFollowUpEndDate\" : 1599602400000\n " +
164+ " },\n " +
165+ " {\n " +
166+ " \" personUuid\" : \" TEYCIW-BHWHMH-MH2QIW-KBP72JMU\" ,\n " +
167+ " \" latestFollowUpEndDate\" : 1593727200000\n " +
168+ " }\n " +
169+ "]" )))
170+ //@formatter:on
171+
73172 public List <PersonFollowUpEndDto > getLatestFollowUpEndDates (@ PathParam ("since" ) long since ) {
74173 return FacadeProvider .getPersonFacade ().getLatestFollowUpEndDates (new Date (since ), true );
75174 }
0 commit comments