io.automatiko.engine.service.exception.BaseExceptionMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of automatiko-service Show documentation
Show all versions of automatiko-service Show documentation
Workflow as a Service - processes and decisions with Automatiko Engine
The newest version!
package io.automatiko.engine.service.exception;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
public abstract class BaseExceptionMapper {
public static final String MESSAGE = "message";
public static final String PROCESS_INSTANCE_ID = "processInstanceId";
public static final String VARIABLE = "variable";
public static final String NODE_INSTANCE_ID = "nodeInstanceId";
public static final String NODE_ID = "nodeId";
public static final String FAILED_NODE_ID = "failedNodeId";
public static final String ID = "id";
protected Response badRequest(R body) {
return Response.status(Response.Status.BAD_REQUEST).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.entity(body).build();
}
protected Response conflict(R body) {
return Response.status(Response.Status.CONFLICT).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.entity(body).build();
}
protected Response internalError(R body) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).entity(body).build();
}
protected Response notFound(R body) {
return Response.status(Response.Status.NOT_FOUND).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.entity(body).build();
}
protected Response forbidden(R body) {
return Response.status(Response.Status.FORBIDDEN).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.entity(body).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy