-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from dbmdz/problem-hints
Add `Problem` hints
- Loading branch information
Showing
37 changed files
with
253 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...l/src/main/java/de/digitalcollections/model/exception/http/client/ForbiddenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package de.digitalcollections.model.exception.http.client; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class ForbiddenException extends HttpClientException { | ||
|
||
public ForbiddenException(String methodKey, int status, String request, Problem problem) { | ||
public ForbiddenException(String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
.../src/main/java/de/digitalcollections/model/exception/http/client/HttpClientException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.client; | ||
|
||
import de.digitalcollections.model.exception.http.HttpException; | ||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class HttpClientException extends HttpException { | ||
|
||
public HttpClientException(String methodKey, int status, String request, Problem problem) { | ||
public HttpClientException(String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ain/java/de/digitalcollections/model/exception/http/client/ResourceNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...rc/main/java/de/digitalcollections/model/exception/http/client/UnauthorizedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.client; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class UnauthorizedException extends HttpClientException { | ||
|
||
public UnauthorizedException(String methodKey, int status, String request, Problem problem) { | ||
public UnauthorizedException( | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...e/digitalcollections/model/exception/http/client/UnavailableForLegalReasonsException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.client; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class UnavailableForLegalReasonsException extends HttpClientException { | ||
|
||
public UnavailableForLegalReasonsException( | ||
String methodKey, int status, String request, Problem problem) { | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
.../java/de/digitalcollections/model/exception/http/client/UnprocessableEntityException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.client; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class UnprocessableEntityException extends HttpClientException { | ||
|
||
public UnprocessableEntityException( | ||
String methodKey, int status, String request, Problem problem) { | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
.../src/main/java/de/digitalcollections/model/exception/http/server/BadGatewayException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package de.digitalcollections.model.exception.http.server; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class BadGatewayException extends HttpServerException { | ||
|
||
public BadGatewayException(String methodKey, int status, String request, Problem problem) { | ||
public BadGatewayException(String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
.../main/java/de/digitalcollections/model/exception/http/server/GatewayTimeOutException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.server; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class GatewayTimeOutException extends HttpServerException { | ||
|
||
public GatewayTimeOutException(String methodKey, int status, String request, Problem problem) { | ||
public GatewayTimeOutException( | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
.../src/main/java/de/digitalcollections/model/exception/http/server/HttpServerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.server; | ||
|
||
import de.digitalcollections.model.exception.http.HttpException; | ||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class HttpServerException extends HttpException { | ||
|
||
public HttpServerException(String methodKey, int status, String request, Problem problem) { | ||
public HttpServerException(String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...a/de/digitalcollections/model/exception/http/server/HttpVersionNotSupportedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.server; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class HttpVersionNotSupportedException extends HttpServerException { | ||
|
||
public HttpVersionNotSupportedException( | ||
String methodKey, int status, String request, Problem problem) { | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
.../main/java/de/digitalcollections/model/exception/http/server/NotImplementedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.server; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class NotImplementedException extends HttpServerException { | ||
|
||
public NotImplementedException(String methodKey, int status, String request, Problem problem) { | ||
public NotImplementedException( | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...n/java/de/digitalcollections/model/exception/http/server/ServiceUnavailableException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package de.digitalcollections.model.exception.http.server; | ||
|
||
import org.zalando.problem.Problem; | ||
import de.digitalcollections.model.exception.problem.MetasvcProblem; | ||
|
||
public class ServiceUnavailableException extends HttpServerException { | ||
|
||
public ServiceUnavailableException( | ||
String methodKey, int status, String request, Problem problem) { | ||
String methodKey, int status, String request, MetasvcProblem problem) { | ||
super(methodKey, status, request, problem); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...svc-model/src/main/java/de/digitalcollections/model/exception/problem/MetasvcProblem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package de.digitalcollections.model.exception.problem; | ||
|
||
import de.digitalcollections.model.validation.ValidationError; | ||
import java.net.URI; | ||
import java.util.Date; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Singular; | ||
import org.zalando.problem.AbstractThrowableProblem; | ||
import org.zalando.problem.StatusType; | ||
|
||
public final class MetasvcProblem extends AbstractThrowableProblem { | ||
|
||
private List<ValidationError> errors; | ||
private Date timestamp; | ||
private ProblemHint hint; | ||
|
||
public MetasvcProblem() { | ||
super(); | ||
} | ||
|
||
public MetasvcProblem( | ||
URI type, String title, StatusType status, String detail, URI instance, Date timestamp) { | ||
super(type, title, status, detail, instance); | ||
this.timestamp = timestamp; | ||
} | ||
|
||
@Builder(setterPrefix = "with") | ||
public MetasvcProblem( | ||
URI type, | ||
String title, | ||
StatusType status, | ||
String detail, | ||
URI instance, | ||
Date timestamp, | ||
@Singular List<ValidationError> errors, | ||
ProblemHint hint) { | ||
super(type, title, status, detail, instance); | ||
this.timestamp = timestamp; | ||
this.errors = errors; | ||
this.hint = hint; | ||
} | ||
|
||
public MetasvcProblem( | ||
URI type, | ||
String title, | ||
StatusType status, | ||
String detail, | ||
URI instance, | ||
Date timestamp, | ||
ProblemHint hint) { | ||
super(type, title, status, detail, instance); | ||
this.timestamp = timestamp; | ||
this.hint = hint; | ||
} | ||
|
||
public List<ValidationError> getErrors() { | ||
return errors; | ||
} | ||
|
||
public Date getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
public ProblemHint getHint() { | ||
return hint; | ||
} | ||
} |
Oops, something went wrong.