Commit b6244184 by Jan Hrabal

errors

parent c9746623
...@@ -12,6 +12,8 @@ import java.util.stream.Collectors; ...@@ -12,6 +12,8 @@ import java.util.stream.Collectors;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
...@@ -31,6 +33,7 @@ import com.jh.boot.jpa.AbstractIdEntity; ...@@ -31,6 +33,7 @@ import com.jh.boot.jpa.AbstractIdEntity;
*/ */
@Entity @Entity
@Table(name = "APP_USER") @Table(name = "APP_USER")
@Inheritance(strategy = InheritanceType.JOINED)
public class AppUser extends AbstractIdEntity { public class AppUser extends AbstractIdEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.jh.boot.web.error; package com.jh.boot.web.error;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* The Class ErrorMessage. * The Class ErrorMessage.
*/ */
public class ErrorMessage { public class ErrorMessage {
/** The field. */ public static final String CODE_VALUE_REQUIRED = "VALUE_REQUIRED";
private String field;
/** The field. */
/** The code. */ private String field;
private String code;
/** The code. */
/** The message. */ private String code;
@JsonProperty("msg")
private String message; /** The message. */
@JsonProperty("msg")
private String message;
/**
* Instantiates a new error message.
*/ /**
private ErrorMessage() { * Instantiates a new error message.
} */
private ErrorMessage() {
}
/* builder methods */
/** /* builder methods */
* Constructs error message with field, code and message .
* /**
* @param field the field * Constructs error message with field, code and message .
* @param code the code *
* @param message the message * @param field the field
* @return the error message * @param code the code
*/ * @param message the message
public static ErrorMessage withFieldCodeMessage(String field, String code, String message) { * @return the error message
ErrorMessage em = new ErrorMessage(); */
em.field = field; public static ErrorMessage withFieldCodeMessage(String field, String code, String message) {
em.code = code; ErrorMessage em = new ErrorMessage();
em.message = message; em.field = field;
return em; em.code = code;
} em.message = message;
return em;
}
/**
* Constructs error message with field, code and message .
* /**
* @param field the field * Constructs error message with field, code and message .
* @param message the message *
* @return the error message * @param field the field
*/ * @param message the message
public static ErrorMessage withFieldMessage(String field, String message) { * @return the error message
ErrorMessage em = new ErrorMessage(); */
em.field = field; public static ErrorMessage withFieldMessage(String field, String message) {
em.message = message; ErrorMessage em = new ErrorMessage();
return em; em.field = field;
} em.message = message;
return em;
}
/**
* Constructs error message with field and code .
* /**
* @param field the field * Constructs error message with field and code .
* @param code the code *
* @return the error message * @param field the field
*/ * @param code the code
public static ErrorMessage withFieldCode(String field, String code) { * @return the error message
ErrorMessage em = new ErrorMessage(); */
em.field = field; public static ErrorMessage withFieldCode(String field, String code) {
em.code = code; ErrorMessage em = new ErrorMessage();
return em; em.field = field;
} em.code = code;
return em;
}
/**
* Constructs error message with code and message .
* /**
* @param code the code * Constructs error message with code and message .
* @param message the message *
* @return the error message * @param code the code
*/ * @param message the message
public static ErrorMessage withCodeMessage(String code, String message) { * @return the error message
ErrorMessage em = new ErrorMessage(); */
em.code = code; public static ErrorMessage withCodeMessage(String code, String message) {
em.message = message; ErrorMessage em = new ErrorMessage();
return em; em.code = code;
} em.message = message;
return em;
}
/**
* With message.
* /**
* @param message the message * With message.
* @return the error message *
*/ * @param message the message
public static ErrorMessage withMessage(String message) { * @return the error message
ErrorMessage em = new ErrorMessage(); */
em.message = message; public static ErrorMessage withMessage(String message) {
return em; ErrorMessage em = new ErrorMessage();
} em.message = message;
return em;
}
/**
* With code.
* /**
* @param code the code * With code.
* @return the error message *
*/ * @param code the code
public static ErrorMessage withCode(String code) { * @return the error message
ErrorMessage em = new ErrorMessage(); */
em.code = code; public static ErrorMessage withCode(String code) {
return em; ErrorMessage em = new ErrorMessage();
} em.code = code;
return em;
}
/* getters */
/** /* getters */
* Gets the field.
* /**
* @return the field * Gets the field.
*/ *
public String getField() { * @return the field
return field; */
} public String getField() {
return field;
/** }
* Gets the code.
* /**
* @return the code * Gets the code.
*/ *
public String getCode() { * @return the code
return code; */
} public String getCode() {
return code;
/** }
* Gets the message.
* /**
* @return the message * Gets the message.
*/ *
public String getMessage() { * @return the message
return message; */
} public String getMessage() {
return message;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment