org.eclipse.microprofile.lra.tck.participant.api

## Class LraCancelOnResource

- java.lang.Object
- - org.eclipse.microprofile.lra.tck.participant.api.LraCancelOnResource

    @ApplicationScoped
     @Path(value="lraresource-cancelon")
    public class LraCancelOnResource
    extends Object

### Field Summary

Fields
`static String` `CANCEL_FROM_REMOTE_CALL`
`static String` `CANCEL_ON_301`
`static String` `CANCEL_ON_FAMILY_3XX`
`static String` `CANCEL_ON_FAMILY_DEFAULT_4XX`
`static String` `CANCEL_ON_FAMILY_DEFAULT_5XX`
`static String` `LRA_CANCEL_ON_RESOURCE_PATH`
`static String` `NOT_CANCEL_ON_FAMILY_5XX`

### Constructor Summary

Constructors
Constructor and Description
`LraCancelOnResource()`

### Method Summary

All Methods Instance Methods Concrete Methods
`jakarta.ws.rs.core.Response` `cancelFromRemoteCall(URI lraId, jakarta.ws.rs.core.UriInfo uriInfo)` Returning `200` thus the LRA should be closed but beforehand it makes a remote REST call which returns 5xx which is the default for the cancelling and so the whole LRA should be cancelled.
`jakarta.ws.rs.core.Response` `cancelOn301(URI lraId)` Cancel on is set to `301`.
`jakarta.ws.rs.core.Response` `cancelOnFamily3xx(URI lraId)` Cancel on family is set to `3xx`.
`jakarta.ws.rs.core.Response` `cancelOnFamilyDefault4xx(URI lraId)` Default return status for cancelling LRA is `4xx` and `5xx`
`jakarta.ws.rs.core.Response` `cancelOnFamilyDefault5xx(URI lraId)` Default return status for cancelling LRA is `4xx` and `5xx`
`jakarta.ws.rs.core.Response` `compensateWork(URI lraId)`
`jakarta.ws.rs.core.Response` `completeWork(URI lraId)`
`jakarta.ws.rs.core.Response` `notCancelOnFamily5xx(URI lraId)` Cancel on family is set to `4xx`, the code from other families (e.g.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### LRA_CANCEL_ON_RESOURCE_PATH

    public static final String LRA_CANCEL_ON_RESOURCE_PATH

See Also:
  Constant Field Values

#### CANCEL_ON_FAMILY_DEFAULT_4XX

    public static final String CANCEL_ON_FAMILY_DEFAULT_4XX

See Also:
  Constant Field Values

#### CANCEL_ON_FAMILY_DEFAULT_5XX

    public static final String CANCEL_ON_FAMILY_DEFAULT_5XX

See Also:
  Constant Field Values

#### CANCEL_ON_FAMILY_3XX

    public static final String CANCEL_ON_FAMILY_3XX

See Also:
  Constant Field Values

#### CANCEL_ON_301

    public static final String CANCEL_ON_301

See Also:
  Constant Field Values

#### NOT_CANCEL_ON_FAMILY_5XX

    public static final String NOT_CANCEL_ON_FAMILY_5XX

See Also:
  Constant Field Values

#### CANCEL_FROM_REMOTE_CALL

    public static final String CANCEL_FROM_REMOTE_CALL

See Also:
  Constant Field Values

### Constructor Detail

#### LraCancelOnResource

    public LraCancelOnResource()

### Method Detail

#### cancelOnFamilyDefault4xx

    @GET
     @Path(value="cancelOnFamilyDefault4xx")
    public jakarta.ws.rs.core.Response cancelOnFamilyDefault4xx(@HeaderParam(value="Long-Running-Action")
                                                                                                              URI lraId)

Default return status for cancelling LRA is `4xx` and `5xx`

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

#### cancelOnFamilyDefault5xx

    @GET
     @Path(value="cancelOnFamilyDefault5xx")
    public jakarta.ws.rs.core.Response cancelOnFamilyDefault5xx(@HeaderParam(value="Long-Running-Action")
                                                                                                              URI lraId)

Default return status for cancelling LRA is `4xx` and `5xx`

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

#### cancelOnFamily3xx

    @GET
     @Path(value="cancelOnFamily3xx")
    public jakarta.ws.rs.core.Response cancelOnFamily3xx(@HeaderParam(value="Long-Running-Action")
                                                                                                URI lraId)

Cancel on family is set to `3xx`. The `3xx` return code has to cancel the LRA.

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

#### cancelOn301

    @GET
     @Path(value="cancelOn301")
    public jakarta.ws.rs.core.Response cancelOn301(@HeaderParam(value="Long-Running-Action")
                                                                                    URI lraId)

Cancel on is set to `301`. The `301` return code has to cancel the LRA.

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

#### notCancelOnFamily5xx

    @GET
     @Path(value="notCancelOnFamily5xx")
    public jakarta.ws.rs.core.Response notCancelOnFamily5xx(@HeaderParam(value="Long-Running-Action")
                                                                                                      URI lraId)

Cancel on family is set to `4xx`, the code from other families (e.g. for `5xx` should not cancel but should go with close the LRA.

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

#### cancelFromRemoteCall

    @GET
     @Path(value="cancelFromRemoteCall")
    public jakarta.ws.rs.core.Response cancelFromRemoteCall(@HeaderParam(value="Long-Running-Action")
                                                                                                      URI lraId,
                                                                                                      @Context
                                                                                                      jakarta.ws.rs.core.UriInfo uriInfo)

Returning `200` thus the LRA should be closed but beforehand it makes a remote REST call which returns 5xx which is the default for the cancelling and so the whole LRA should be cancelled.

The remote REST call invokes the same resource class `LraCancelOnResource` That assumes the call to the representative of the same LRA participant as it's already enlisted by the method `cancelFromRemoteCall(java.net.URI, jakarta.ws.rs.core.UriInfo)` invoked by the test. Because the specification mandates that the same participant can be enlisted only once per LRA instance then the `Compensate` method `compensateWork(URI)` will be called only once for the test invocation.

Parameters:
  `lraId` - The LRA id generated for this action
  `uriInfo` - as context provided by JAX-RS to find base service URI
Returns:
  JAX-RS response

#### completeWork

    @PUT
     @Path(value="/complete")
    public jakarta.ws.rs.core.Response completeWork(@HeaderParam(value="Long-Running-Action")
                                                                                   URI lraId)

#### compensateWork

    @PUT
     @Path(value="/compensate")
    public jakarta.ws.rs.core.Response compensateWork(@HeaderParam(value="Long-Running-Action")
                                                                                       URI lraId)