package models;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import controllers.Identity;
import play.db.ebean.Model;

@Entity
public class AssistanceCall extends Model {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public String id;
	
	public String hostname;
	
	public String date;
	
	public String details;
	
	@ManyToOne
	public Student student;
	

	public static Finder<String, AssistanceCall> find = new Finder<String, AssistanceCall>(String.class, AssistanceCall.class);

	public AssistanceCall(String hostname, String date, String details, String uuid) {
		String hashedUuid = Identity.hashed(uuid);
		System.out.println("----!!!!!!!!!!-------- UUID : " + uuid +" ; hashed : " + hashedUuid);
		this.student = Student.find.ref(hashedUuid);
		this.hostname = hostname;
		this.date = date;
		this.details = details;
	}

    public static int count() {
        return find.findRowCount();
    }
	
	public static List<AssistanceCall> all() {
	  return find.all();
	}

	public static void create(AssistanceCall assistanceCall) {
		assistanceCall.student = Student.find.ref(assistanceCall.student.hashedUuid);
		System.out.println("Assistance call :\n"
				+ "hashedUuid : " + assistanceCall.student.hashedUuid +"\n"
				+ "details : "+ assistanceCall.details+"\n"
				+ "hostname : "+ assistanceCall.hostname);
		assistanceCall.save();
		System.out.println("-------------------Model--------------------"+assistanceCall.id);
	}
	
	public static void delete(String id, String s) {
		find.byId(id).delete();
	}
	
}

@@ -816,32 +816,34 @@
 hashed(uuid);%0A%09%09
+//
 System.out.print
@@ -1327,16 +1327,18 @@
 dUuid);%0A
+//
 %09%09System
@@ -1368,24 +1368,26 @@
 e call :%5Cn%22%0A
+//
 %09%09%09%09+ %22hashe
@@ -1434,24 +1434,26 @@
 dUuid +%22%5Cn%22%0A
+//
 %09%09%09%09+ %22detai
@@ -1488,16 +1488,18 @@
 ls+%22%5Cn%22%0A
+//
 %09%09%09%09+ %22h
@@ -1566,96 +1566,8 @@
 ();%0A
-%09%09System.out.println(%22-------------------Model--------------------%22+assistanceCall.id);%0A
 %09%7D%0A%09

Comment some System.out