javax.ws.rs.PATCH Java Examples

The following examples show how to use javax.ws.rs.PATCH. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExperimentRestApi.java    From submarine with Apache License 2.0 6 votes vote down vote up
@PATCH
@Path("/{id}")
@Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON})
@Operation(summary = "Update the experiment in the submarine server with spec",
        tags = {"experiment"},
        responses = {
                @ApiResponse(description = "successful operation", content = @Content(
                        schema = @Schema(implementation = JsonResponse.class))),
                @ApiResponse(responseCode = "404", description = "Experiment not found")})
public Response patchExperiment(@PathParam(RestConstants.ID) String id, ExperimentSpec spec) {
  try {
    Experiment experiment = experimentManager.patchExperiment(id, spec);
    return new JsonResponse.Builder<Experiment>(Response.Status.OK).success(true)
        .result(experiment).build();
  } catch (SubmarineRuntimeException e) {
    return parseExperimentServiceException(e);
  }
}
 
Example #2
Source File: ProductVersionEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 * 
 * @param id {@value PV_ID}
 * @param productVersion
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ProductVersion.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
ProductVersion patchSpecific(
        @Parameter(description = PV_ID) @PathParam("id") String id,
        @NotNull ProductVersion productVersion);
 
Example #3
Source File: ProductMilestoneEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 * 
 * @param id {@value PM_ID}
 * @param productMilestone
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ProductMilestone.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
ProductMilestone patchSpecific(
        @Parameter(description = PM_ID) @PathParam("id") String id,
        @NotNull ProductMilestone productMilestone);
 
Example #4
Source File: ProductReleaseEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 * 
 * @param id {@value PR_ID}
 * @param productRelease
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ProductRelease.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
ProductRelease patchSpecific(
        @Parameter(description = PR_ID) @PathParam("id") String id,
        @NotNull ProductRelease productRelease);
 
Example #5
Source File: GroupConfigurationEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 *
 * @param id {@value GC_ID}
 * @param groupConfig
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = GroupConfiguration.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
GroupConfiguration patchSpecific(
        @Parameter(description = GC_ID) @PathParam("id") String id,
        @NotNull GroupConfiguration groupConfig);
 
Example #6
Source File: GoogleSheetsResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Path("/update")
@PATCH
@Consumes(MediaType.TEXT_PLAIN)
public Response updateSheet(@QueryParam("spreadsheetId") String spreadsheetId, String title) {
    BatchUpdateSpreadsheetRequest request = new BatchUpdateSpreadsheetRequest()
            .setIncludeSpreadsheetInResponse(true)
            .setRequests(Collections
                    .singletonList(new Request().setUpdateSpreadsheetProperties(new UpdateSpreadsheetPropertiesRequest()
                            .setProperties(new SpreadsheetProperties().setTitle(title))
                            .setFields("title"))));

    final Map<String, Object> headers = new HashMap<>();
    headers.put("CamelGoogleSheets.spreadsheetId", spreadsheetId);
    headers.put("CamelGoogleSheets.batchUpdateSpreadsheetRequest", request);
    producerTemplate.requestBodyAndHeaders("google-sheets://spreadsheets/batchUpdate", null, headers);
    return Response.ok().build();
}
 
Example #7
Source File: ProjectEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 * 
 * @param id {@value P_ID}
 * @param project
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = Project.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
Project patchSpecific(@Parameter(description = P_ID) @PathParam("id") String id, @NotNull Project project);
 
Example #8
Source File: Encryption.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PATCH
@Path("passphrase")
public Response enterPassphrase(
    @Context Request request,
    String jsonData
)
{
    return requestHelper.doInScope(ApiConsts.API_ENTER_CRYPT_PASS, request, () ->
    {
        String passPhrase = objectMapper.readValue(jsonData, String.class);

        ApiCallRc apiCallRc = ctrlApiCallHandler.enterPassphrase(passPhrase);

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.OK);
    }, true);
}
 
Example #9
Source File: TrellisHttpResource.java    From trellis with Apache License 2.0 6 votes vote down vote up
/**
 * Perform a PATCH operation on an LDP Resource.
 *
 * @param uriInfo the URI info
 * @param secContext the security context
 * @param headers the HTTP headers
 * @param request the request
 * @param body the body
 * @return the async response
 */
@PATCH
@Timed
@Operation(summary = "Update a linked data resource")
public CompletionStage<Response> updateResource(@Context final Request request, @Context final UriInfo uriInfo,
        @Context final HttpHeaders headers, @Context final SecurityContext secContext,
        @RequestBody(description = "The update request for RDF resources, typically as SPARQL-Update",
                     required = true,
                     content = @Content(mediaType = "application/sparql-update")) final String body) {
    final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, secContext);
    final String urlBase = getBaseUrl(req);
    final IRI identifier = buildTrellisIdentifier(req.getPath());
    final PatchHandler patchHandler = new PatchHandler(req, body, trellis, extensions, supportsCreateOnPatch,
            defaultJsonLdProfile, urlBase);

    return getParent(identifier).thenCombine(trellis.getResourceService().get(identifier), patchHandler::initialize)
        .thenCompose(patchHandler::updateResource).thenCompose(patchHandler::updateMemento)
        .thenApply(ResponseBuilder::build).exceptionally(this::handleException);
}
 
Example #10
Source File: SCMRepositoryEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC}
 *
 * @param id {@value SCM_ID}
 * @param scmRepository
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = SCMRepository.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
SCMRepository patchSpecific(
        @Parameter(description = SCM_ID) @PathParam("id") String id,
        @NotNull SCMRepository scmRepository);
 
Example #11
Source File: ProductEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 * 
 * @param id {@value P_ID}
 * @param product
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = Product.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
Product patchSpecific(@Parameter(description = P_ID) @PathParam("id") String id, @NotNull Product product);
 
Example #12
Source File: BuildConfigurationEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 *
 * @param id {@value BC_ID}
 * @param buildConfig
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = BuildConfiguration.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
BuildConfiguration patchSpecific(
        @Parameter(description = BC_ID) @PathParam("id") String id,
        BuildConfiguration buildConfig);
 
Example #13
Source File: Pagamenti.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{id}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updatePagamento(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is, @PathParam("id") String id){
    this.buildContext();
    return this.controller.updatePagamento(this.getUser(), uriInfo, httpHeaders, is,  id);
}
 
Example #14
Source File: Operatori.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{principal}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updateOperatore(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is, @PathParam("principal") String principal){
    this.buildContext();
    return this.controller.updateOperatore(this.getUser(), uriInfo, httpHeaders, is,  principal);
}
 
Example #15
Source File: Applicazioni.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{idA2A}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updateApplicazione(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is, @PathParam("idA2A") String idA2A){
    this.buildContext();
    return this.controller.updateApplicazione(this.getUser(), uriInfo, httpHeaders, is,  idA2A);
}
 
Example #16
Source File: Configurazioni.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response aggiornaConfigurazioni(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is){
    this.buildContext();
    return this.controller.aggiornaConfigurazioni(this.getUser(), uriInfo, httpHeaders, is);
}
 
Example #17
Source File: Ruoli.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{idRuolo}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updateRuolo(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is, @PathParam("idRuolo") String idRuolo){
	this.buildContext();
    return this.controller.updateRuolo(this.getUser(), uriInfo, httpHeaders, is,  idRuolo);
}
 
Example #18
Source File: Rpp.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{idDominio}/{iuv}/n/a")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updateRpp(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is, @PathParam("idDominio") String idDominio, @PathParam("iuv") String iuv){
    this.buildContext();
    return this.controller.updateRpp(this.getUser(), uriInfo, httpHeaders, is,  idDominio,  iuv,  "n/a");
}
 
Example #19
Source File: Rpp.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{idDominio}/{iuv}/{ccp}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updateRpp(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, java.io.InputStream is, @PathParam("idDominio") String idDominio, @PathParam("iuv") String iuv, @PathParam("ccp") String ccp){
    this.buildContext();
    return this.controller.updateRpp(this.getUser(), uriInfo, httpHeaders, is,  idDominio,  iuv,  ccp);
}
 
Example #20
Source File: Pendenze.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{idA2A}/{idPendenza}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response updatePendenza(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, @PathParam("idA2A") String idA2A, @PathParam("idPendenza") String idPendenza, java.io.InputStream is){
    this.buildContext();
    return this.controller.pendenzeIdA2AIdPendenzaPATCH(this.getUser(), uriInfo, httpHeaders,  idA2A,  idPendenza, is);
}
 
Example #21
Source File: Pendenze.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@PATCH
@Path("/{idA2A}/{idPendenza}")
@Consumes({ "application/json" })
public Response updatePendenza(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, @PathParam("idA2A") String idA2A, @PathParam("idPendenza") String idPendenza, java.io.InputStream is){
    this.buildContext();
    return this.controller.updatePendenza(this.getUser(), uriInfo, httpHeaders,  idA2A,  idPendenza, is,true);
}
 
Example #22
Source File: RemediationService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Perform remediation by updating the provided user, group or any object.
 *
 * @param remediationKey key for remediation to act on
 * @param updateReq user, group or any object to update
 * @return Response object featuring the updated object enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "remediationKey", description = "Remediation's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Object successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{remediationKey}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response remedy(@NotNull @PathParam("remediationKey") String remediationKey, @NotNull AnyUR updateReq);
 
Example #23
Source File: GroupService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Updates group matching the provided key.
 *
 * @param updateReq modification to be applied to group matching the provided key
 * @return Response object featuring the updated group enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "Group's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Group successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull GroupUR updateReq);
 
Example #24
Source File: AnyObjectService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Updates any object matching the provided key.
 *
 * @param updateReq modification to be applied to any object matching the provided key
 * @return Response object featuring the updated any object enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "Any Object's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "Any object successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull AnyObjectUR updateReq);
 
Example #25
Source File: UserSelfService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Self-updates user.
 *
 * @param updateReq modification to be applied to self
 * @return Response object featuring the updated user
 */
@Operation(security = {
    @SecurityRequirement(name = "BasicAuthentication"),
    @SecurityRequirement(name = "Bearer") })
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "User successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")) })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull UserUR updateReq);
 
Example #26
Source File: UserService.java    From syncope with Apache License 2.0 5 votes vote down vote up
/**
 * Updates user matching the provided key.
 *
 * @param updateReq modification to be applied to user matching the provided key
 * @return Response object featuring the updated user enriched with propagation status information
 */
@Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER,
        description = "Allows client to specify a preference for the result to be returned from the server",
        allowEmptyValue = true, schema =
        @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" }))
@Parameter(name = HttpHeaders.IF_MATCH, in = ParameterIn.HEADER,
        description = "When the provided ETag value does not match the latest modification date of the entity, "
        + "an error is reported and the requested operation is not performed.",
        allowEmptyValue = true, schema =
        @Schema(type = "string"))
@Parameter(name = RESTHeaders.NULL_PRIORITY_ASYNC, in = ParameterIn.HEADER,
        description = "If 'true', instructs the propagation process not to wait for completion when communicating"
        + " with External Resources with no priority set",
        allowEmptyValue = true, schema =
        @Schema(type = "boolean", defaultValue = "false"))
@Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema =
        @Schema(type = "string"))
@ApiResponses({
    @ApiResponse(responseCode = "200",
            description = "User successfully updated enriched with propagation status information, as Entity",
            content =
            @Content(schema =
                    @Schema(implementation = ProvisioningResult.class))),
    @ApiResponse(responseCode = "204",
            description = "No content if 'Prefer: return-no-content' was specified", headers =
            @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema =
                    @Schema(type = "string"),
                    description = "Allows the server to inform the "
                    + "client about the fact that a specified preference was applied")),
    @ApiResponse(responseCode = "412",
            description = "The ETag value provided via the 'If-Match' header does not match the latest modification"
            + " date of the entity") })
@PATCH
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
Response update(@NotNull UserUR updateReq);
 
Example #27
Source File: RestSBControllerImplTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@PATCH
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response patch(InputStream payload) throws IOException {
    String responseText = IOUtils.toString(payload, StandardCharsets.UTF_8);
    if (responseText.equalsIgnoreCase(SAMPLE_PAYLOAD)) {
        return Response.ok().build();
    }
    return Response.status(Response.Status.EXPECTATION_FAILED).build();
}
 
Example #28
Source File: ApiPermissionInfoGenerator.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
private static String getMethodType(Method method) {
    Set<String> httpAnnotations = Lists.newArrayList(GET.class, DELETE.class, PUT.class, POST.class, HEAD.class, OPTIONS.class, PATCH.class)
            .stream()
            .filter(httpAnnotation -> method.isAnnotationPresent(httpAnnotation))
            .map(httpAnnotation -> httpAnnotation.getSimpleName())
            .collect(Collectors.toSet());
    return Joiner.on(" ").join(httpAnnotations);
}
 
Example #29
Source File: Api.java    From apicurio-registry with Apache License 2.0 5 votes vote down vote up
@PATCH
@Path("/schemas/{schemaid}")
@Consumes({"application/json"})
@Produces({"application/json"})
public Response apiSchemasSchemaidPatch(@PathParam("schemaid") String schemaid, @NotNull @Valid List<AnyOfStateModificationEnabledModification> anyOfStateModificationEnabledModification)
throws ArtifactNotFoundException {
    return service.apiSchemasSchemaidPatch(schemaid, anyOfStateModificationEnabledModification);
}
 
Example #30
Source File: Api.java    From apicurio-registry with Apache License 2.0 5 votes vote down vote up
@PATCH
@Path("/schemas/{schemaid}/versions/{versionnum}")
@Consumes({"application/json"})
@Produces({"application/json"})
public Response apiSchemasSchemaidVersionsVersionnumPatch(@PathParam("schemaid") String schemaid, @PathParam("versionnum") int versionnum, @NotNull @Valid List<AnyOfStateModificationEnabledModification> anyOfStateModificationEnabledModification)
throws ArtifactNotFoundException {
    return service.apiSchemasSchemaidVersionsVersionnumPatch(schemaid, versionnum, anyOfStateModificationEnabledModification);
}