UserDTO.java

package com.tradecloud.dto.api.user;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.tradecloud.dto.api.organisation.OrganisationDTO;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.validation.constraints.Pattern;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.datatype.XMLGregorianCalendar;

/**
 * Created by ds on 2017/12/21.
 */
@Access(AccessType.FIELD)

@JsonRootName(value = "userDTO")
@XmlTransient
public class UserDTO {

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The first name of the user.")
    private String firstName;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The last name of the user.")
    private String lastName;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private String password;

    private String token;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The organisation name.")
    private OrganisationDTO organisation;

    private XMLGregorianCalendar tokenExpiration;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The user's email address. This will also be used as the username the person will use to log in to" +
            "the Tradecloud system.")
    @Pattern(regexp = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[a-zA-Z]{2,4}$", message = "Email format is not valid")
    private String email;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The user's contact number. This will be used to contact the user on sign-off.")
    private String phone;

    private String scope;

    protected XMLGregorianCalendar lastLoginDate;

    private String message;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public OrganisationDTO getOrganisation() {
        return organisation;
    }

    public void setOrganisation(OrganisationDTO organisation) {
        this.organisation = organisation;
    }

    public XMLGregorianCalendar getLastLoginDate() {
        return lastLoginDate;
    }

    public void setLastLoginDate(XMLGregorianCalendar lastLoginDate) {
        this.lastLoginDate = lastLoginDate;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public XMLGregorianCalendar getTokenExpiration() {
        return tokenExpiration;
    }

    public void setTokenExpiration(XMLGregorianCalendar tokenExpiration) {
        this.tokenExpiration = tokenExpiration;
    }
}