Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
59 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
51 changes: 51 additions & 0 deletions
51
src/main/java/ru/mail/jira/plugins/disposition/rest/ErrorListEntity.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,51 @@ | ||
package ru.mail.jira.plugins.disposition.rest; | ||
|
||
import javax.ws.rs.core.Response.Status; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
||
/** | ||
* @author g.chernyshev | ||
*/ | ||
|
||
@XmlRootElement(name = "error") | ||
public class ErrorListEntity { | ||
@XmlAttribute | ||
private int status; | ||
|
||
@XmlElement(name = "message") | ||
private Collection<String> errors; | ||
|
||
public ErrorListEntity() { | ||
} | ||
|
||
public ErrorListEntity(int status, String... errors) { | ||
this(status, Arrays.asList(errors)); | ||
} | ||
|
||
public ErrorListEntity(int status, Collection<String> errors) { | ||
this.status = status; | ||
this.errors = errors; | ||
} | ||
|
||
public ErrorListEntity(Status status, String... errors) { | ||
this(status, Arrays.asList(errors)); | ||
} | ||
|
||
public ErrorListEntity(Status status, Collection<String> errors) { | ||
this.status = status.getStatusCode(); | ||
this.errors = errors; | ||
} | ||
|
||
public Collection<String> getErrors() { | ||
return errors; | ||
} | ||
|
||
public int getStatus() { | ||
return status; | ||
} | ||
} | ||
|
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