package ca.corefacility.bioinformatics.irida.web.assembler.resource.user;

import ca.corefacility.bioinformatics.irida.model.User;
import java.net.URI;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.springframework.hateoas.ResourceSupport;

/**
 * Wrapper for exposing User resources to the web with linking support.
 *
 * @author Josh Adam <josh.adam@phac-aspc.gc.ca>
 * @author Thomas Matthews <thomas.matthews@phac-aspc.gc.ca>
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 */
@XmlRootElement(name = "user")
public class UserResource extends ResourceSupport {

    private User user;

    public UserResource() {
    }

    public UserResource(User user) {
        this.user = user;
    }

    @XmlElement
    public URI getURI() {
        return user.getIdentifier().getUri();
    }

    @XmlElement
    public String getUsername() {
        return user.getUsername();
    }

    @XmlElement
    public String getEmail() {
        return user.getEmail();
    }

    @XmlElement
    public String getFirstName() {
        return user.getFirstName();
    }

    @XmlElement
    public String getLastName() {
        return user.getLastName();
    }

    @XmlElement
    public String getPhoneNumber() {
        return user.getPhoneNumber();
    }
}

@@ -124,16 +124,68 @@
 l.User;%0A
+import com.fasterxml.jackson.annotation.JsonIgnore;%0A
 import j
@@ -732,24 +732,51 @@
 esource() %7B%0A
+        user = new User();%0A
     %7D%0A%0A    p
@@ -1019,32 +1019,122 @@
 rname();%0A    %7D%0A%0A
+    public void setUsername(String username) %7B%0A        user.setUsername(username);%0A    %7D%0A%0A
     @XmlElement%0A
@@ -1195,32 +1195,110 @@
 Email();%0A    %7D%0A%0A
+    public void setEmail(String email) %7B%0A        user.setEmail(email);%0A    %7D%0A%0A
     @XmlElement%0A
@@ -1383,185 +1383,633 @@
     
-@XmlElement%0A    public String getLastName() %7B%0A        return user.getLastName();%0A    %7D%0A%0A    @XmlElement%0A    public String getPhoneNumber() %7B%0A        return user.getPhoneNumber()
+public void setFirstName(String firstName) %7B%0A        user.setFirstName(firstName);%0A    %7D%0A%0A    @XmlElement%0A    public String getLastName() %7B%0A        return user.getLastName();%0A    %7D%0A%0A    public void setLastName(String lastName) %7B%0A        user.setLastName(lastName);%0A    %7D%0A%0A    @XmlElement%0A    public String getPhoneNumber() %7B%0A        return user.getPhoneNumber();%0A    %7D%0A%0A    public void setPhoneNumber(String phoneNumber) %7B%0A        user.setPhoneNumber(phoneNumber);%0A    %7D%0A%0A    public void setPassword(String password) %7B%0A        user.setPassword(password);%0A    %7D%0A%0A    @JsonIgnore%0A    public User getUser() %7B%0A        return user
 ;%0A  

Add setters for all fields so that Spring can populate a UserResource.