package edu.northwestern.bioinformatics.studycalendar.domain.delta;

import gov.nih.nci.cabig.ctms.domain.AbstractMutableDomainObject;

import java.util.Date;

import edu.northwestern.bioinformatics.studycalendar.domain.StudySite;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * @author Rhett Sutphin
 */
@Entity
@Table(name = "amendment_approvals")
@GenericGenerator(name="id-generator", strategy = "native",
    parameters = {
        @Parameter(name="sequence", value="seq_amendment_approvals_id")
    }
)
public class AmendmentApproval extends AbstractMutableDomainObject {
    private Amendment amendment;
    private StudySite studySite;
    private Date date;

    ////// BEAN PROPERTIES

    @ManyToOne
    public Amendment getAmendment() {
        return amendment;
    }

    public void setAmendment(Amendment amendment) {
        this.amendment = amendment;
    }

    @ManyToOne
    public StudySite getStudySite() {
        return studySite;
    }

    public void setStudySite(StudySite studySite) {
        this.studySite = studySite;
    }

    @Column(name = "approval_date")
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
}

@@ -852,16 +852,508 @@
  date;%0A%0A
+    ////// FACTORIES%0A%0A    public static AmendmentApproval create(Amendment amendment, Date approvalDate) %7B%0A        return create(null, amendment, approvalDate);%0A    %7D%0A%0A    public static AmendmentApproval create(StudySite studySite, Amendment amendment, Date approvalDate) %7B%0A        AmendmentApproval approval = new AmendmentApproval();%0A        approval.setAmendment(amendment);%0A        approval.setStudySite(studySite);%0A        approval.setDate(approvalDate);%0A        return approval;%0A    %7D%0A%0A
     ////

Add factory methods