Loading src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotDeletedException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotDeletedException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotDeletedException extends WebApplicationException { public EntityNotDeletedException(String message, Exception e) { super(message, e); } public EntityNotDeletedException(String message) { super(message); } } src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotFoundException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotFoundException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotFoundException extends WebApplicationException { public EntityNotFoundException(String message, Exception e) { super(message, e); } public EntityNotFoundException(String message) { super(message); } } src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotPersistedException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotPersistedException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotPersistedException extends WebApplicationException { public EntityNotPersistedException(String message, Exception e) { super(message, e); } public EntityNotPersistedException(String message) { super(message); } } src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotUpdatedException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotUpdatedException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotUpdatedException extends WebApplicationException { public EntityNotUpdatedException(String message, Exception e) { super(message, e); } public EntityNotUpdatedException(String message) { super(message); } } src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/WebServiceExceptionMapper.java +56 −26 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/WebServiceExceptionMapper.java: 56 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -18,34 +18,40 @@ public class WebServiceExceptionMapper implements ExceptionMapper<WebApplication private static final Map<Class<?>, Function<WebApplicationException, Response>> KNOWN_EXCEPTION_MAP = Map.of( Exception.class, WebServiceExceptionMapper::responseFromException, org.etsi.osl.hypo.api.tmf.common.exception.DuplicateKeyException.class, e -> responseFromDuplicateKeyException( (org.etsi.osl.hypo.api.tmf.common.exception.DuplicateKeyException) e), org.etsi.osl.hypo.api.tmf.common.exception.DependencyException.class, e -> responseFromDependencyException( (org.etsi.osl.hypo.api.tmf.common.exception.DependencyException) e), org.etsi.osl.hypo.api.tmf.common.exception.UUIDPersistentException.class, e -> responseFromUUIDPersistentException( (org.etsi.osl.hypo.api.tmf.common.exception.UUIDPersistentException) e), org.etsi.osl.hypo.api.tmf.common.exception.ServiceNotFoundException.class, e -> responseFromServiceSpecNotFoundException( (org.etsi.osl.hypo.api.tmf.common.exception.ServiceNotFoundException) e), org.etsi.osl.hypo.api.tmf.common.exception.UpdateStateNotAllowedException.class, Map.ofEntries( Map.entry(Exception.class, WebServiceExceptionMapper::responseFromException), Map.entry( DuplicateKeyException.class, e -> responseFromDuplicateKeyException((DuplicateKeyException) e)), Map.entry( DependencyException.class, e -> responseFromDependencyException((DependencyException) e)), Map.entry( UUIDPersistentException.class, e -> responseFromUUIDPersistentException((UUIDPersistentException) e)), Map.entry( ServiceNotFoundException.class, e -> responseFromServiceSpecNotFoundException((ServiceNotFoundException) e)), Map.entry( EntityNotPersistedException.class, e -> responseFromEntityNotPersistedException((EntityNotPersistedException) e)), Map.entry( EntityNotFoundException.class, e -> responseFromEntityNotFoundException((EntityNotFoundException) e)), Map.entry( EntityNotUpdatedException.class, e -> responseFromEntityNotUpdateException((EntityNotUpdatedException) e)), Map.entry( EntityNotDeletedException.class, e -> responseFromEntityNotDeletedException((EntityNotDeletedException) e)), Map.entry( UpdateStateNotAllowedException.class, e -> responseFromUpdateStateNotAllowedException( (org.etsi.osl.hypo.api.tmf.common.exception .UpdateStateNotAllowedException) e), org.etsi.osl.hypo.api.tmf.common.exception.ValidationException.class, e -> responseValidationException( (org.etsi.osl.hypo.api.tmf.common.exception.ValidationException) e)); (UpdateStateNotAllowedException) e)), Map.entry( ValidationException.class, e -> responseValidationException((ValidationException) e))); @Override public Response toResponse(WebApplicationException exception) { Loading @@ -61,6 +67,30 @@ public class WebServiceExceptionMapper implements ExceptionMapper<WebApplication return Response.status(Response.Status.NOT_FOUND).entity(errorMessage).build(); } public static Response responseFromEntityNotPersistedException(EntityNotPersistedException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); } public static Response responseFromEntityNotFoundException(EntityNotFoundException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.NOT_FOUND).entity(errorMessage).build(); } public static Response responseFromEntityNotUpdateException(EntityNotUpdatedException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.CONFLICT).entity(errorMessage).build(); } public static Response responseFromEntityNotDeletedException(EntityNotDeletedException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.CONFLICT).entity(errorMessage).build(); } private static Response responseFromUpdateStateNotAllowedException( UpdateStateNotAllowedException e) { ErrorMessage errorMessage = new ErrorMessage(); Loading Loading
src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotDeletedException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotDeletedException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotDeletedException extends WebApplicationException { public EntityNotDeletedException(String message, Exception e) { super(message, e); } public EntityNotDeletedException(String message) { super(message); } }
src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotFoundException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotFoundException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotFoundException extends WebApplicationException { public EntityNotFoundException(String message, Exception e) { super(message, e); } public EntityNotFoundException(String message) { super(message); } }
src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotPersistedException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotPersistedException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotPersistedException extends WebApplicationException { public EntityNotPersistedException(String message, Exception e) { super(message, e); } public EntityNotPersistedException(String message) { super(message); } }
src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotUpdatedException.java +14 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/EntityNotUpdatedException.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line package org.etsi.osl.hypo.api.tmf.common.exception; import jakarta.ws.rs.WebApplicationException; public class EntityNotUpdatedException extends WebApplicationException { public EntityNotUpdatedException(String message, Exception e) { super(message, e); } public EntityNotUpdatedException(String message) { super(message); } }
src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/WebServiceExceptionMapper.java +56 −26 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/common/exception/WebServiceExceptionMapper.java: 56 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -18,34 +18,40 @@ public class WebServiceExceptionMapper implements ExceptionMapper<WebApplication private static final Map<Class<?>, Function<WebApplicationException, Response>> KNOWN_EXCEPTION_MAP = Map.of( Exception.class, WebServiceExceptionMapper::responseFromException, org.etsi.osl.hypo.api.tmf.common.exception.DuplicateKeyException.class, e -> responseFromDuplicateKeyException( (org.etsi.osl.hypo.api.tmf.common.exception.DuplicateKeyException) e), org.etsi.osl.hypo.api.tmf.common.exception.DependencyException.class, e -> responseFromDependencyException( (org.etsi.osl.hypo.api.tmf.common.exception.DependencyException) e), org.etsi.osl.hypo.api.tmf.common.exception.UUIDPersistentException.class, e -> responseFromUUIDPersistentException( (org.etsi.osl.hypo.api.tmf.common.exception.UUIDPersistentException) e), org.etsi.osl.hypo.api.tmf.common.exception.ServiceNotFoundException.class, e -> responseFromServiceSpecNotFoundException( (org.etsi.osl.hypo.api.tmf.common.exception.ServiceNotFoundException) e), org.etsi.osl.hypo.api.tmf.common.exception.UpdateStateNotAllowedException.class, Map.ofEntries( Map.entry(Exception.class, WebServiceExceptionMapper::responseFromException), Map.entry( DuplicateKeyException.class, e -> responseFromDuplicateKeyException((DuplicateKeyException) e)), Map.entry( DependencyException.class, e -> responseFromDependencyException((DependencyException) e)), Map.entry( UUIDPersistentException.class, e -> responseFromUUIDPersistentException((UUIDPersistentException) e)), Map.entry( ServiceNotFoundException.class, e -> responseFromServiceSpecNotFoundException((ServiceNotFoundException) e)), Map.entry( EntityNotPersistedException.class, e -> responseFromEntityNotPersistedException((EntityNotPersistedException) e)), Map.entry( EntityNotFoundException.class, e -> responseFromEntityNotFoundException((EntityNotFoundException) e)), Map.entry( EntityNotUpdatedException.class, e -> responseFromEntityNotUpdateException((EntityNotUpdatedException) e)), Map.entry( EntityNotDeletedException.class, e -> responseFromEntityNotDeletedException((EntityNotDeletedException) e)), Map.entry( UpdateStateNotAllowedException.class, e -> responseFromUpdateStateNotAllowedException( (org.etsi.osl.hypo.api.tmf.common.exception .UpdateStateNotAllowedException) e), org.etsi.osl.hypo.api.tmf.common.exception.ValidationException.class, e -> responseValidationException( (org.etsi.osl.hypo.api.tmf.common.exception.ValidationException) e)); (UpdateStateNotAllowedException) e)), Map.entry( ValidationException.class, e -> responseValidationException((ValidationException) e))); @Override public Response toResponse(WebApplicationException exception) { Loading @@ -61,6 +67,30 @@ public class WebServiceExceptionMapper implements ExceptionMapper<WebApplication return Response.status(Response.Status.NOT_FOUND).entity(errorMessage).build(); } public static Response responseFromEntityNotPersistedException(EntityNotPersistedException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); } public static Response responseFromEntityNotFoundException(EntityNotFoundException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.NOT_FOUND).entity(errorMessage).build(); } public static Response responseFromEntityNotUpdateException(EntityNotUpdatedException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.CONFLICT).entity(errorMessage).build(); } public static Response responseFromEntityNotDeletedException(EntityNotDeletedException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setMessage(e.getMessage()); return Response.status(Response.Status.CONFLICT).entity(errorMessage).build(); } private static Response responseFromUpdateStateNotAllowedException( UpdateStateNotAllowedException e) { ErrorMessage errorMessage = new ErrorMessage(); Loading