@Test public void shouldThrowEntityNotFoundIfNoConnectorTemplateExists() { assertThatThrownBy(() -> new CustomConnectorHandler(dataManager, applicationContext, iconDao).create( new ConnectorSettings.Builder().connectorTemplateId("non-existent").build()) ).isInstanceOf(EntityNotFoundException.class).hasMessage("Connector template: non-existent"); }
@POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") public Connector create(final ConnectorSettings connectorSettings) { final Connector connector = withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.generate(template, connectorSettings)); return getDataManager().create(connector); }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") public Connector create(final ConnectorSettings connectorSettings) { final Connector connector = withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.generate(template, connectorSettings)); return getDataManager().create(connector); } }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") public Connector create(final ConnectorSettings connectorSettings) { final Connector connector = withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.generate(template, connectorSettings)); return getDataManager().create(connector); } CustomConnectorHandler(final DataManager dataManager, final ApplicationContext applicationContext, final IconDao iconDao); }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") public Connector create(final ConnectorSettings connectorSettings) { final Connector connector = withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.generate(template, connectorSettings)); return getDataManager().create(connector); } CustomConnectorHandler(final DataManager dataManager, final ApplicationContext applicationContext, final IconDao iconDao); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(final ConnectorSettings connectorSettings); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings` multipart part, plus optional `icon` file") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(@MultipartForm CustomConnectorFormData customConnectorFormData); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(final ConnectorSettings connectorSettings); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(@MultipartForm final CustomConnectorFormData connectorFormData); }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") public Connector create(final ConnectorSettings connectorSettings) { final Connector connector = withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.generate(template, connectorSettings)); return getDataManager().create(connector); } CustomConnectorHandler(final DataManager dataManager, final ApplicationContext applicationContext, final IconDao iconDao); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(final ConnectorSettings connectorSettings); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings` multipart part, plus optional `icon` file") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(@MultipartForm CustomConnectorFormData customConnectorFormData); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(final ConnectorSettings connectorSettings); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(@MultipartForm final CustomConnectorFormData connectorFormData); static final String SPECIFICATION; }