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: @SuppressWarnings("unchecked")
      @Test
      public void returnLinkableItemTypesForTriggerChannelType() throws IOException {
          ChannelTypeUID channelTypeUID = new ChannelTypeUID("binding", "ct");
          ChannelType channelType = ChannelTypeBuilder.trigger(channelTypeUID, "Label").build();
  
          when(channelTypeRegistry.getChannelType(channelTypeUID)).thenReturn(channelType);
  
          TriggerProfileType profileType = mock(TriggerProfileType.class);
          when(profileType.getSupportedChannelTypeUIDs()).thenReturn(List.of(channelTypeUID));
          when(profileType.getSupportedItemTypes()).thenReturn(List.of("Switch", "Dimmer"));
  
          when(profileTypeRegistry.getProfileTypes()).thenReturn(List.of(profileType));
  
          Response response = channelTypeResource.getLinkableItemTypes(channelTypeUID.getAsString());
  
          verify(channelTypeRegistry).getChannelType(channelTypeUID);
          verify(profileTypeRegistry).getProfileTypes();
          assertThat(response.getStatus(), is(200));
          assertThat((Set<String>) response.getEntity(), IsIterableContaining.hasItems("Switch", "Dimmer"));
      }
test_case.class_method_signature: ChannelTypeResourceTest.returnLinkableItemTypesForTriggerChannelType()
test_case.full_signature: @SuppressWarnings("unchecked") @Test public void returnLinkableItemTypesForTriggerChannelType()
test_case.identifier: returnLinkableItemTypesForTriggerChannelType
test_case.invocations: build trigger thenReturn when getChannelType mock thenReturn when getSupportedChannelTypeUIDs of thenReturn when getSupportedItemTypes of thenReturn when getProfileTypes of getLinkableItemTypes getAsString getChannelType verify getProfileTypes verify assertThat getStatus is assertThat getEntity hasItems
test_case.modifiers: @SuppressWarnings("unchecked") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void returnLinkableItemTypesForTriggerChannelType()
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
      @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) {
          ChannelTypeUID ctUID = new ChannelTypeUID(channelTypeUID);
          ChannelType channelType = channelTypeRegistry.getChannelType(ctUID);
          if (channelType == null) {
              return Response.status(Status.NOT_FOUND).build();
          }
          if (channelType.getKind() != ChannelKind.TRIGGER) {
              return Response.noContent().build();
          }
  
          Set<String> result = new HashSet<>();
          for (ProfileType profileType : profileTypeRegistry.getProfileTypes()) {
              if (profileType instanceof TriggerProfileType) {
                  if (((TriggerProfileType) profileType).getSupportedChannelTypeUIDs().contains(ctUID)) {
                      for (String itemType : profileType.getSupportedItemTypes()) {
                          result.add(itemType);
                      }
                  }
              }
          }
          if (result.isEmpty()) {
              return Response.noContent().build();
          }
  
          return Response.ok(result).build();
      }
focal_method.class_method_signature: ChannelTypeResource.getLinkableItemTypes(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)
focal_method.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_method.identifier: getLinkableItemTypes
focal_method.invocations: getChannelType build status getKind build noContent getProfileTypes contains getSupportedChannelTypeUIDs getSupportedItemTypes add isEmpty build noContent build ok
focal_method.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_method.parameters: (
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)
focal_method.return: Response
focal_method.signature: Response getLinkableItemTypes(
              @PathParam("channelTypeUID") @Parameter(description = "channelTypeUID") String channelTypeUID)