package at.fhj.swd14.pse.user;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import at.fhj.swd14.pse.community.Community;
import at.fhj.swd14.pse.community.UserCommunity;
import at.fhj.swd14.pse.tag.Tag;

import java.io.Serializable;
import java.util.List;

@Entity
@Table(name = "user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    
    @Column
    private String username;    
    
    @Column
    private String password;
    
    @Column
    private String salt;
    

    @OneToMany(mappedBy = "user")
    private List<UserCommunity> userCommunities;
  
    public List<UserCommunity> getCommunities(){
    	return userCommunities;
    }
    
    public User(Long id) {
        this.id = id;
    }

    public User() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMail() {
		return username;
	}

	public void setMail(String mail) {
		this.username = mail;
	}

	public String getPassword() {
		return password;
	}

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

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	@Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", mail='" + username + '\'' +
                '}';
    }
}

@@ -308,16 +308,57 @@
 Table;%0A%0A
+import at.fhj.swd14.pse.comment.Comment;%0A
 import a
@@ -386,32 +386,32 @@
 nity.Community;%0A
-
 import at.fhj.sw
@@ -435,32 +435,73 @@
 .UserCommunity;%0A
+import at.fhj.swd14.pse.message.Message;%0A
 import at.fhj.sw
@@ -1094,24 +1094,178 @@
 %0A    %7D%0A    %0A
+    @ManyToMany(mappedBy = %22users%22)%0A    private List%3CComment%3E comments;%0A    %0A    @ManyToMany(mappedBy = %22users%22)%0A    private List%3CMessage%3E messages;%0A    %0A
     public U
@@ -1798,18 +1798,319 @@
 = salt;%0A
-
 %09%7D
+%0A%09%0A%09public void setComments(List%3CComment%3E comments) %7B%0A%09%09this.comments = comments;%0A%09%7D%0A%09%0A%09public List%3CComment%3E getComments() %7B%0A%09%09return this.comments;%0A%09%7D%0A%09%0A%09public void setMessages(List%3CMessage%3E messages) %7B%0A%09%09this.messages = messages;%0A%09%7D%0A%09%0A%09public List%3CMessage%3E getMessages() %7B%0A%09%09return this.messages;%0A%7D
 %0A%0A%09@Over

fix merge conflicts