package uk.ac.ebi.spot.goci.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import java.util.Collection;

/**
 * Created by emma on 04/12/14.
 *
 * @author emma
 *         <p>
 *         Model object representing an EFO trait which is normally assigned at the SNP level
 */

@Entity
public class EfoTrait {
    @Id
    @GeneratedValue
    private Long id;

    private String trait;

    private String uri;

    @ManyToMany(mappedBy = "efoTraits")
    private Collection<Study> studies;

    @ManyToMany(mappedBy = "efoTraits")
    private Collection<Association> associations;

    // JPA no-args constructor
    public EfoTrait() {
    }

    public EfoTrait(String trait, String uri) {
        this.trait = trait;
        this.uri = uri;
    }

    public Long getId() {
        return id;
    }

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

    public String getTrait() {
        return trait;
    }

    public void setTrait(String trait) {
        this.trait = trait;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    @Override
    public String toString() {
        return "EfoTrait{" +
                "id=" + id +
                ", trait='" + trait + '\'' +
                ", uri='" + uri + '\'' +
                '}';
    }
}

@@ -772,73 +772,272 @@
 ait,
- String uri) %7B%0A        this.trait = trait;%0A        this.uri = uri
+%0A                    String uri,%0A                    Collection%3CStudy%3E studies,%0A                    Collection%3CAssociation%3E associations) %7B%0A        this.trait = trait;%0A        this.uri = uri;%0A        this.studies = studies;%0A        this.associations = associations
 ;%0A  
@@ -1423,44 +1423,43 @@
     
-@Override%0A    public String toString
+public Collection%3CStudy%3E getStudies
 () %7B
@@ -1478,156 +1478,322 @@
 urn 
-%22EfoTrait%7B%22 +
+studies;
 %0A    
+%7D%0A%0A
     
-        %22id=%22 + id +%0A                %22, trait='%22 + trait + '%5C'' +%0A                %22, uri='%22 + uri + '%5C'' +%0A                '%7D'
+public void setStudies(Collection%3CStudy%3E studies) %7B%0A        this.studies = studies;%0A    %7D%0A%0A    public Collection%3CAssociation%3E getAssociations() %7B%0A        return associations;%0A    %7D%0A%0A    public void setAssociations(Collection%3CAssociation%3E associations) %7B%0A        this.associations = associations
 ;%0A  

Update to getter/setter and constructor