77import io .swagger .v3 .oas .annotations .media .Schema ;
88import io .swagger .v3 .oas .annotations .responses .ApiResponse ;
99import io .swagger .v3 .oas .annotations .responses .ApiResponses ;
10+ import io .swagger .v3 .oas .annotations .Operation ;
11+ import io .swagger .v3 .oas .annotations .Parameter ;
1012import org .phoebus .channelfinder .AuthorizationService .ROLES ;
1113import org .phoebus .channelfinder .entity .Channel ;
1214import org .phoebus .channelfinder .entity .Property ;
4143import java .util .stream .StreamSupport ;
4244
4345import static org .phoebus .channelfinder .CFResourceDescriptors .CHANNEL_RESOURCE_URI ;
46+ import static org .phoebus .channelfinder .CFResourceDescriptors .SEARCH_PARAM_DESCRIPTION ;
4447
4548@ CrossOrigin
4649@ RestController
@@ -69,14 +72,12 @@ public class ChannelManager {
6972 @ Autowired
7073 ChannelProcessorService channelProcessorService ;
7174
72- /**
73- * GET method for querying a collection of Channel instances, based on a
74- * multi-parameter query specifying patterns for tags, property values, and
75- * channel names to match against.
76- *
77- * @param allRequestParams query parameters
78- * @return list of all channels
79- */
75+ @ Operation (
76+ summary = "Query channels" ,
77+ description = "Query a collection of Channel instances based on tags, property values, and channel names." ,
78+ operationId = "queryChannels" ,
79+ tags = {"Channel" }
80+ )
8081 @ ApiResponses (
8182 value = {
8283 @ ApiResponse (
@@ -94,18 +95,18 @@ public class ChannelManager {
9495 content = @ Content (schema = @ Schema (implementation = ResponseStatusException .class )))
9596 })
9697 @ GetMapping
97- public List <Channel > query (@ RequestParam MultiValueMap <String , String > allRequestParams ) {
98+ public List <Channel > query (
99+ @ Parameter (description = SEARCH_PARAM_DESCRIPTION )
100+ @ RequestParam MultiValueMap <String , String > allRequestParams ) {
98101 return channelRepository .search (allRequestParams ).channels ();
99102 }
100103
101- /**
102- * GET method for querying for a collection of Channel instances, based on a
103- * multi-parameter query specifying patterns for tags, property values, and
104- * channel names to match against.
105- *
106- * @param allRequestParams query parameters
107- * @return SearchResult a count to the total number of matches and the first 10k hits
108- */
104+ @ Operation (
105+ summary = "Combined query for channels" ,
106+ description = "Query for a collection of Channel instances and get a count and the first 10k hits." ,
107+ operationId = "combinedQueryChannels" ,
108+ tags = {"Channel" }
109+ )
109110 @ ApiResponses (
110111 value = {
111112 @ ApiResponse (
@@ -123,17 +124,18 @@ public List<Channel> query(@RequestParam MultiValueMap<String, String> allReques
123124 content = @ Content (schema = @ Schema (implementation = ResponseStatusException .class )))
124125 })
125126 @ GetMapping ("/combined" )
126- public SearchResult combinedQuery (@ RequestParam MultiValueMap <String , String > allRequestParams ) {
127+ public SearchResult combinedQuery (
128+ @ Parameter (description = SEARCH_PARAM_DESCRIPTION )
129+ @ RequestParam MultiValueMap <String , String > allRequestParams ) {
127130 return channelRepository .search (allRequestParams );
128131 }
129132
130- /**
131- * GET method for querying the number of matches to a multi-parameter query specifying patterns for tags, property values, and
132- * channel names to match against.
133- *
134- * @param allRequestParams query parameters
135- * @return a total number of channels that match the query parameters
136- */
133+ @ Operation (
134+ summary = "Count channels matching query" ,
135+ description = "Get the number of channels matching the given query parameters." ,
136+ operationId = "countChannels" ,
137+ tags = {"Channel" }
138+ )
137139 @ ApiResponses (
138140 value = {
139141 @ ApiResponse (
@@ -146,17 +148,18 @@ public SearchResult combinedQuery(@RequestParam MultiValueMap<String, String> al
146148 content = @ Content (schema = @ Schema (implementation = ResponseStatusException .class )))
147149 })
148150 @ GetMapping ("/count" )
149- public long queryCount (@ RequestParam MultiValueMap <String , String > allRequestParams ) {
151+ public long queryCount (
152+ @ Parameter (description = SEARCH_PARAM_DESCRIPTION )
153+ @ RequestParam MultiValueMap <String , String > allRequestParams ) {
150154 return channelRepository .count (allRequestParams );
151155 }
152156
153- /**
154- * GET method for retrieving an instance of Channel identified by
155- * <code>channelName</code>.
156- *
157- * @param channelName - channel name to search for
158- * @return found channel
159- */
157+ @ Operation (
158+ summary = "Get channel by name" ,
159+ description = "Retrieve a Channel instance by its name." ,
160+ operationId = "getChannelByName" ,
161+ tags = {"Channel" }
162+ )
160163 @ ApiResponses (
161164 value = {
162165 @ ApiResponse (
@@ -182,15 +185,12 @@ public Channel read(@PathVariable("channelName") String channelName) {
182185 }
183186 }
184187
185- /**
186- * PUT method for creating/replacing a channel instance identified by the
187- * payload. The <b>complete</b> set of properties for the channel must be
188- * supplied, which will replace the existing set of properties.
189- *
190- * @param channelName - name of channel to be created
191- * @param channel - new data (properties/tags) for channel <code>chan</code>
192- * @return the created channel
193- */
188+ @ Operation (
189+ summary = "Create or replace a channel" ,
190+ description = "Create or replace a channel instance identified by the payload." ,
191+ operationId = "createOrReplaceChannel" ,
192+ tags = {"Channel" }
193+ )
194194 @ ApiResponses (
195195 value = {
196196 @ ApiResponse (
@@ -248,12 +248,12 @@ public Channel create(@PathVariable("channelName") String channelName, @RequestB
248248 }
249249 }
250250
251- /**
252- * PUT method for creating multiple channels.
253- *
254- * @param channels - XmlChannels to be created
255- * @return the list of channels created
256- */
251+ @ Operation (
252+ summary = "Create or replace multiple channels" ,
253+ description = "Create or replace multiple channel instances." ,
254+ operationId = "createOrReplaceChannels" ,
255+ tags = { "Channel" }
256+ )
257257 @ ApiResponses (
258258 value = {
259259 @ ApiResponse (
@@ -347,14 +347,12 @@ private void resetOwnersToExisting(Iterable<Channel> channels) {
347347 }
348348 }
349349
350- /**
351- * POST method for merging properties and tags of the channel identified by the
352- * payload into an existing channel.
353- *
354- * @param channelName - name of channel to add
355- * @param channel - new Channel data (properties/tags) to be merged into channel <code>channelName</code>
356- * @return the updated channel
357- */
350+ @ Operation (
351+ summary = "Update a channel" ,
352+ description = "Merge properties and tags of the channel identified by the payload into an existing channel." ,
353+ operationId = "updateChannel" ,
354+ tags = {"Channel" }
355+ )
358356 @ ApiResponses (
359357 value = {
360358 @ ApiResponse (
@@ -427,13 +425,12 @@ public Channel update(@PathVariable("channelName") String channelName, @RequestB
427425 }
428426 }
429427
430- /**
431- * POST method for merging properties and tags of the Channels identified by the
432- * payload into existing channels.
433- *
434- * @param channels - XmlChannels to be updated
435- * @return the updated channels
436- */
428+ @ Operation (
429+ summary = "Update multiple channels" ,
430+ description = "Merge properties and tags of the channels identified by the payload into existing channels." ,
431+ operationId = "updateChannels" ,
432+ tags = {"Channel" }
433+ )
437434 @ ApiResponses (
438435 value = {
439436 @ ApiResponse (
@@ -497,12 +494,12 @@ public Iterable<Channel> update(@RequestBody Iterable<Channel> channels) {
497494 }
498495 }
499496
500- /**
501- * DELETE method for deleting a channel instance identified by path parameter
502- * <code>channelName</code>.
503- *
504- * @param channelName - name of channel to remove
505- */
497+ @ Operation (
498+ summary = "Delete a channel" ,
499+ description = "Delete a channel instance identified by its name." ,
500+ operationId = "deleteChannel" ,
501+ tags = { "Channel" }
502+ )
506503 @ ApiResponses (
507504 value = {
508505 @ ApiResponse (
0 commit comments