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

import org.springframework.transaction.annotation.Transactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.northwestern.bioinformatics.studycalendar.domain.delta.Amendment;
import edu.northwestern.bioinformatics.studycalendar.dao.StudyCalendarDao;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: nshurupova
 * Date: Aug 29, 2007
 * Time: 3:41:38 PM
 * To change this template use File | Settings | File Templates.
 */
public class AmendmentDao  extends StudyCalendarDao<Amendment> {
        private static final Logger log = LoggerFactory.getLogger(AmendmentDao.class.getName());

    public Class<Amendment> domainClass() {
        return Amendment.class;
    }

    public List<Amendment> getAll() {
        return getHibernateTemplate().find("from Amendment");
    }

    @Transactional(readOnly = false)
    public void save(Amendment amendment) {
        getHibernateTemplate().saveOrUpdate(amendment);
    }

    public List<Amendment> getByName (String name) {
        return getHibernateTemplate().find("from Amendment a where a.name= ?", name);
    }

    public List<Amendment> getByDate(String date) {
        return getHibernateTemplate().find("from Amendment a where a.date= ?", date);
    }

    public Amendment getByPreviousAmendmentId(Integer previousAmendmentId) {
        List<Amendment> results = getHibernateTemplate().find("from Amendment a where a.previousAmendment= ?", previousAmendmentId);
        return results.get(0);
    }

    public Amendment getByStudyId(Integer studyId) {
        List<Amendment> results = getHibernateTemplate().find("from Amendment a where a.studyId= ?", studyId);
        return results.get(0);
    }
}

@@ -70,626 +70,359 @@
 ort 
-org.springframework.transaction.annotation.Transactional;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport edu.northwestern.bioinformatics.studycalendar.domain.delta.Amendment;%0Aimport edu.northwestern.bioinformatics.studycalendar.dao.StudyCalendarDao;%0A%0Aimport java.util.List;%0A%0A/**%0A * Created by IntelliJ IDEA.%0A * User: nshurupova%0A * Date: Aug 29, 2007%0A * Time: 3:41:38 PM%0A * To change this template use File %7C Settings %7C File Templates.%0A */%0Apublic class AmendmentDao  extends StudyCalendarDao%3CAmendment%3E %7B%0A        private static final Logger log = LoggerFactory.getLogger(AmendmentDao.class.getName());%0A
+edu.northwestern.bioinformatics.studycalendar.dao.StudyCalendarDao;%0Aimport edu.northwestern.bioinformatics.studycalendar.domain.delta.Amendment;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0Aimport java.util.List;%0A%0A/**%0A * @author Nataliya Shurupova%0A */%0Apublic class AmendmentDao  extends StudyCalendarDao%3CAmendment%3E %7B%0A    @Override
 %0A   
@@ -760,149 +760,19 @@
     
-public List%3CAmendment%3E getByName (String name) %7B%0A        return getHibernateTemplate().find(%22from Amendment a where a.name= ?%22, name);%0A    %7D%0A
+@Deprecated
 %0A   
@@ -771,37 +771,32 @@
 ated%0A    public 
-List%3C
 Amendment%3E getBy
@@ -792,568 +792,101 @@
 ment
-%3E
  getBy
-Date(String date) %7B%0A        return getHibernateTemplate().find(%22from Amendment a where a.date= ?%22, date);%0A    %7D%0A%0A    public Amendment getByPreviousAmendmentId(Integer previousAmendmentId) %7B%0A        List%3CAmendment%3E results = getHibernateTemplate().find(%22from Amendment a where a.previousAmendment= ?%22, previousAmendmentId);%0A        return results.get(0);%0A    %7D%0A%0A    public Amendment getByStudyId(Integer studyId) %7B%0A        List%3CAmendment%3E results = getHibernateTemplate().find(%22from Amendment a where a.studyId= ?%22, studyId);%0A        return results.get(0
+StudyId(Integer studyId) %7B%0A        throw new UnsupportedOperationException(%22Deprecated%22
 );%0A 

Remove unused/untested methods; deprecate & de-support getStudyById because that field's about to disappear