package de.passau.uni.sec.compose.id.rest.messages;

import java.util.Date;

import de.passau.uni.sec.compose.id.core.persistence.entities.Membership;

public class MembershipResponseMessage implements EntityResponseMessage
{
	private String id;
	
	private String user_id;
	
	private String role;
	
	private String group_id;
	
	private Date lastModified;

	public MembershipResponseMessage(Membership mem)
	{
		id = mem.getId();
		group_id = mem.getGroup().getId();
		role = mem.getRole().getName();
		lastModified = mem.getLastModified();
		user_id=mem.getUser().getId();
		
	}
	
	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}
	public Date getLastModified() {
		return lastModified;
	}
	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}

	public String getGroup_id() {
		return group_id;
	}

	public void setGroup_id(String group_id) {
		this.group_id = group_id;
	}

	public String getUser_id() {
		return user_id;
	}

	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}

	public String getId() {
		return id;
	}

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

@@ -316,24 +316,83 @@
 group_id;%0A%09%0A
+%09private String group_name;%0A%09%0A%09private String user_name;%0A%09%0A
 %09private Dat
@@ -407,16 +407,16 @@
 dified;%0A
-
 %0A%09public
@@ -625,16 +625,100 @@
 etId();%0A
+%09%09group_name = mem.getGroup().getName();%0A%09%09user_name = mem.getUser().getUsername();%0A
 %09%09%0A%09%7D%0A%09%0A
@@ -1318,18 +1318,296 @@
  id;%0A%09%7D%0A
-%09
 %0A%09
+public String getGroup_name()%0A%09%7B%0A%09%09return group_name;%0A%09%7D%0A%0A%09public void setGroup_name(String group_name)%0A%09%7B%0A%09%09this.group_name = group_name;%0A%09%7D%0A%0A%09public String getUser_name()%0A%09%7B%0A%09%09return user_name;%0A%09%7D%0A%0A%09public void setUser_name(String user_name)%0A%09%7B%0A%09%09this.user_name = user_name;%0A%09%7D
 %0A%09%0A%09%0A%7D%0A

Add username and group name to every user membership.