test_class.declarator: channelTypeResource
test_class.modifier: private
test_class.original_string: private ChannelTypeResource channelTypeResource;
test_class.type: ChannelTypeResource
test_class.var_name: channelTypeResource
test_class.declarator: channelTypeRegistry
test_class.modifier: private @Mock
test_class.original_string: private @Mock ChannelTypeRegistry channelTypeRegistry;
test_class.type: ChannelTypeRegistry
test_class.var_name: channelTypeRegistry
test_class.declarator: configDescriptionRegistry
test_class.modifier: private @Mock
test_class.original_string: private @Mock ConfigDescriptionRegistry configDescriptionRegistry;
test_class.type: ConfigDescriptionRegistry
test_class.var_name: configDescriptionRegistry
test_class.declarator: localeService
test_class.modifier: private @Mock
test_class.original_string: private @Mock LocaleServiceImpl localeService;
test_class.type: LocaleServiceImpl
test_class.var_name: localeService
test_class.declarator: profileTypeRegistry
test_class.modifier: private @Mock
test_class.original_string: private @Mock ProfileTypeRegistry profileTypeRegistry;
test_class.type: ProfileTypeRegistry
test_class.var_name: profileTypeRegistry
test_class.file: bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResourceTest.java
test_class.identifier: ChannelTypeResourceTest
test_case.body: @Test
      public void getAllShouldRetrieveAllChannelTypes() throws Exception {
          when(localeService.getLocale(null)).thenReturn(Locale.ENGLISH);
          channelTypeResource.getAll(null, null);
          verify(channelTypeRegistry).getChannelTypes(Locale.ENGLISH);
      }
test_case.class_method_signature: ChannelTypeResourceTest.getAllShouldRetrieveAllChannelTypes()
test_case.full_signature: @Test public void getAllShouldRetrieveAllChannelTypes()
test_case.identifier: getAllShouldRetrieveAllChannelTypes
test_case.invocations: thenReturn when getLocale getAll getChannelTypes verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getAllShouldRetrieveAllChannelTypes()
focal_class.declarator: PATH_CHANNEL_TYPES = "channel-types"
focal_class.modifier: public static final
focal_class.original_string: public static final String PATH_CHANNEL_TYPES = "channel-types";
focal_class.type: String
focal_class.var_name: PATH_CHANNEL_TYPES
focal_class.declarator: channelTypeRegistry
focal_class.modifier: private final
focal_class.original_string: private final ChannelTypeRegistry channelTypeRegistry;
focal_class.type: ChannelTypeRegistry
focal_class.var_name: channelTypeRegistry
focal_class.declarator: configDescriptionRegistry
focal_class.modifier: private final
focal_class.original_string: private final ConfigDescriptionRegistry configDescriptionRegistry;
focal_class.type: ConfigDescriptionRegistry
focal_class.var_name: configDescriptionRegistry
focal_class.declarator: localeService
focal_class.modifier: private final
focal_class.original_string: private final LocaleService localeService;
focal_class.type: LocaleService
focal_class.var_name: localeService
focal_class.declarator: profileTypeRegistry
focal_class.modifier: private final
focal_class.original_string: private final ProfileTypeRegistry profileTypeRegistry;
focal_class.type: ProfileTypeRegistry
focal_class.var_name: profileTypeRegistry
focal_class.file: bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResource.java
focal_class.identifier: ChannelTypeResource
focal_class.interfaces: implements RESTResource
focal_class.class_method_signature: ChannelTypeResource.ChannelTypeResource( //
              final @Reference ChannelTypeRegistry channelTypeRegistry,
              final @Reference ConfigDescriptionRegistry configDescriptionRegistry,
              final @Reference LocaleService localeService, //
              final @Reference ProfileTypeRegistry profileTypeRegistry)
focal_class.full_signature: @Activate public  ChannelTypeResource( //
              final @Reference ChannelTypeRegistry channelTypeRegistry,
              final @Reference ConfigDescriptionRegistry configDescriptionRegistry,
              final @Reference LocaleService localeService, //
              final @Reference ProfileTypeRegistry profileTypeRegistry)
focal_class.identifier: ChannelTypeResource
focal_class.modifiers: @Activate public
focal_class.parameters: ( //
              final @Reference ChannelTypeRegistry channelTypeRegistry,
              final @Reference ConfigDescriptionRegistry configDescriptionRegistry,
              final @Reference LocaleService localeService, //
              final @Reference ProfileTypeRegistry profileTypeRegistry)
focal_class.signature:  ChannelTypeResource( //
              final @Reference ChannelTypeRegistry channelTypeRegistry,
              final @Reference ConfigDescriptionRegistry configDescriptionRegistry,
              final @Reference LocaleService localeService, //
              final @Reference ProfileTypeRegistry profileTypeRegistry)
focal_class.class_method_signature: ChannelTypeResource.getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_class.full_signature: @GET @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets all available channel types.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChannelTypeDTO.class), uniqueItems = true))) }) public Response getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_class.identifier: getAll
focal_class.modifiers: @GET @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets all available channel types.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChannelTypeDTO.class), uniqueItems = true))) }) public
focal_class.parameters: (
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_class.return: Response
focal_class.signature: Response getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_class.class_method_signature: ChannelTypeResource.getByUID(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID,
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language)
focal_class.full_signature: @GET @Path("/{channelTypeUID}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets channel type by UID.", responses = { @ApiResponse(responseCode = "200", description = "Channel type with provided channelTypeUID does not exist.", content = @Content(schema = @Schema(implementation = ChannelTypeDTO.class))), @ApiResponse(responseCode = "404", description = "No content") }) public Response getByUID(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID,
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language)
focal_class.identifier: getByUID
focal_class.modifiers: @GET @Path("/{channelTypeUID}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets channel type by UID.", responses = { @ApiResponse(responseCode = "200", description = "Channel type with provided channelTypeUID does not exist.", content = @Content(schema = @Schema(implementation = ChannelTypeDTO.class))), @ApiResponse(responseCode = "404", description = "No content") }) public
focal_class.parameters: (
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID,
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language)
focal_class.return: Response
focal_class.signature: Response getByUID(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID,
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language)
focal_class.class_method_signature: ChannelTypeResource.getLinkableItemTypes(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)
focal_class.full_signature: @GET @Path("/{channelTypeUID}/linkableItemTypes") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets the item types the given trigger channel type UID can be linked to.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class), uniqueItems = true))), @ApiResponse(responseCode = "204", description = "No content: channel type has no linkable items or is no trigger channel."), @ApiResponse(responseCode = "404", description = "Given channel type UID not found.") }) public Response getLinkableItemTypes(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)
focal_class.identifier: getLinkableItemTypes
focal_class.modifiers: @GET @Path("/{channelTypeUID}/linkableItemTypes") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets the item types the given trigger channel type UID can be linked to.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class), uniqueItems = true))), @ApiResponse(responseCode = "204", description = "No content: channel type has no linkable items or is no trigger channel."), @ApiResponse(responseCode = "404", description = "Given channel type UID not found.") }) public
focal_class.parameters: (
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)
focal_class.return: Response
focal_class.signature: Response getLinkableItemTypes(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)
focal_class.class_method_signature: ChannelTypeResource.convertToChannelTypeDTO(ChannelType channelType, Locale locale)
focal_class.full_signature: private ChannelTypeDTO convertToChannelTypeDTO(ChannelType channelType, Locale locale)
focal_class.identifier: convertToChannelTypeDTO
focal_class.modifiers: private
focal_class.parameters: (ChannelType channelType, Locale locale)
focal_class.return: ChannelTypeDTO
focal_class.signature: ChannelTypeDTO convertToChannelTypeDTO(ChannelType channelType, Locale locale)
focal_method.body: @GET
      @Produces(MediaType.APPLICATION_JSON)
      @Operation(summary = "Gets all available channel types.", responses = {
              @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChannelTypeDTO.class), uniqueItems = true))) })
      public Response getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes) {
          Locale locale = localeService.getLocale(language);
  
          Stream<ChannelTypeDTO> channelStream = channelTypeRegistry.getChannelTypes(locale).stream()
                  .map(c -> convertToChannelTypeDTO(c, locale));
  
          if (prefixes != null) {
              Predicate<ChannelTypeDTO> filter = ct -> false;
              for (String prefix : prefixes.split(",")) {
                  filter = filter.or(ct -> ct.UID.startsWith(prefix + ":"));
              }
              channelStream = channelStream.filter(filter);
          }
  
          return Response.ok(new Stream2JSONInputStream(channelStream)).build();
      }
focal_method.class_method_signature: ChannelTypeResource.getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_method.full_signature: @GET @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets all available channel types.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChannelTypeDTO.class), uniqueItems = true))) }) public Response getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_method.identifier: getAll
focal_method.invocations: getLocale map stream getChannelTypes convertToChannelTypeDTO split or startsWith filter build ok
focal_method.modifiers: @GET @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Gets all available channel types.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChannelTypeDTO.class), uniqueItems = true))) }) public
focal_method.parameters: (
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)
focal_method.return: Response
focal_method.signature: Response getAll(
              @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
              @QueryParam("prefixes") @Parameter(description = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes)