package org.pdxfinder.dao;

import java.util.HashSet;
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * Created by jmason on 16/03/2017.
 */
@NodeEntity
public class PatientSnapshot {

    @GraphId
    Long id;

    Patient patient;
    String age;

    @Relationship(type = "SAMPLED_FROM", direction = Relationship.OUTGOING)
    Set<Sample> samples;

    public PatientSnapshot() {
    }

    public PatientSnapshot(Patient patient, String age) {
        this.patient = patient;
        this.age = age;
    }

    public PatientSnapshot(Patient patient, String age, Set<Sample> samples) {
        this.patient = patient;
        this.age = age;
        this.samples = samples;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public Set<Sample> getSamples() {
        return samples;
    }

    public void setSamples(Set<Sample> samples) {
        this.samples = samples;
    }
    
    public void addSample(Sample sample){
        if(this.samples == null){
            this.samples = new HashSet<Sample>();
        }
        this.samples.add(sample);
    }

    public Patient getPatient() {
        return patient;
    }

    public void setPatient(Patient patient) {
        this.patient = patient;
    }
}

@@ -47,16 +47,17 @@
 ashSet;%0A
+%0A
 import o
@@ -458,16 +458,124 @@
 mples;%0A%0A
+    @Relationship(type = %22TREATED_WITH%22, direction = Relationship.INCOMING)%0A    Set%3CTreatment%3E treatments;%0A%0A
     publ
@@ -891,32 +891,271 @@
 samples;%0A    %7D%0A%0A
+    public PatientSnapshot(Patient patient, String age, Set%3CSample%3E samples, Set%3CTreatment%3E treatments) %7B%0A        this.patient = patient;%0A        this.age = age;%0A        this.samples = samples;%0A        this.treatments = treatments;%0A    %7D%0A%0A
     public Strin
@@ -1708,24 +1708,24 @@
  patient) %7B%0A
-
         this
@@ -1749,11 +1749,193 @@
 t;%0A    %7D
+%0A%0A    public Set%3CTreatment%3E getTreatments() %7B%0A        return treatments;%0A    %7D%0A%0A    public void setTreatments(Set%3CTreatment%3E treatments) %7B%0A        this.treatments = treatments;%0A    %7D
 %0A%7D%0A

Add Treatment relationship