<commit_before>package gov.nih.nci.cabig.caaers.dao;

import gov.nih.nci.cabig.caaers.dao.report.ReportDao;
import gov.nih.nci.cabig.caaers.domain.ExpeditedAdverseEventReport;
import gov.nih.nci.cabig.caaers.domain.ReportStatus;
import gov.nih.nci.cabig.caaers.domain.report.ContactMechanismBasedRecipient;
import gov.nih.nci.cabig.caaers.domain.report.DeliveryStatus;
import gov.nih.nci.cabig.caaers.domain.report.NotificationBodyContent;
import gov.nih.nci.cabig.caaers.domain.report.PlannedEmailNotification;
import gov.nih.nci.cabig.caaers.domain.report.PlannedNotification;
import gov.nih.nci.cabig.caaers.domain.report.Recipient;
import gov.nih.nci.cabig.caaers.domain.report.ReportDefinition;
import gov.nih.nci.cabig.caaers.domain.report.Report;
import gov.nih.nci.cabig.caaers.domain.report.RoleBasedRecipient;
import gov.nih.nci.cabig.caaers.domain.report.ScheduledEmailNotification;
import gov.nih.nci.cabig.caaers.domain.report.ScheduledNotification;
import gov.nih.nci.cabig.caaers.domain.report.TimeScaleUnit;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;


public class ReportDaoStub extends ReportDao {

	HashMap<Object,Report> map = new HashMap<Object, Report>();

	public ReportDaoStub() {
		init(-444);
		init(-885);
	}
	public void init(int reportId){
		Report rs = getDummyReportSchedule(reportId);
		map.put(rs.getName() + reportId, rs);

	}
	@Override
	public Report getById(int id) {
		logger.debug("ReportScheduleDAOStub : getById(" + id +")");
		for(Report rs : map.values()){
			if(rs.getId() == id) return rs;
		}
		logger.debug("ReportScheduleDAOStub : getById(returning NULL )");
		return null;
	}



	/* (non-Javadoc)
	 * @see gov.nih.nci.cabig.caaers.dao.ReportScheduleDao#save(gov.nih.nci.cabig.caaers.helper.ReportSchedule)
	 */
	@Override
	public void save(Report rs) {
		logger.debug("ReportDaoStub : save()\r\n" + String.valueOf(rs));
		map.put(rs.getName(), rs);
	}


	public Report getDummyReportSchedule(final int reportId){

		ReportDefinition rct = null;
		ExpeditedAdverseEventReport aeReport = new ExpeditedAdverseEventReport();
		aeReport.setId(reportId);

		Report rs = null;


		Calendar cal = GregorianCalendar.getInstance();
		Date now = new Date();

		List<Recipient> rList = new ArrayList<Recipient>();
		rList.add(new RoleBasedRecipient("Reporter"));
		rList.add(new ContactMechanismBasedRecipient("<EMAIL>"));

		NotificationBodyContent content = new NotificationBodyContent();
		content.setBody("This is my body".getBytes());

		List<ScheduledNotification> snfList = new ArrayList<ScheduledNotification>();
		List<PlannedNotification> pnfList = new ArrayList<PlannedNotification>();



		rct = new ReportDefinition();
		rct.setDescription("a rct description");
		rct.setDuration(5);
		rct.setId(-333);
		rct.setName("24 Hr 5Day report");
		rct.setTimeScaleUnitType(TimeScaleUnit.MINUTE);
		rct.setPlannedNotifications(pnfList);


		rs = new Report(){
			int callCount = 0;
			public ReportStatus getStatus(){
				callCount++;
				if(reportId == -885 && callCount > 1)
					return ReportStatus.COMPLETED;
				return super.getStatus();
			}
		};
		rs.setStatus(ReportStatus.PENDING);
		//rs.setName("24Hour5Day("+ reportId+")");
		rs.setCreatedOn(new Date());
		rs.setId(reportId);<commit_msg>Update for changes to notification domain objs<commit_after>package gov.nih.nci.cabig.caaers.dao;

import gov.nih.nci.cabig.caaers.dao.report.ReportDao;
import gov.nih.nci.cabig.caaers.domain.ExpeditedAdverseEventReport;
import gov.nih.nci.cabig.caaers.domain.ReportStatus;
import gov.nih.nci.cabig.caaers.domain.report.ContactMechanismBasedRecipient;
import gov.nih.nci.cabig.caaers.domain.report.DeliveryStatus;
import gov.nih.nci.cabig.caaers.domain.report.NotificationBodyContent;
import gov.nih.nci.cabig.caaers.domain.report.PlannedEmailNotification;
import gov.nih.nci.cabig.caaers.domain.report.PlannedNotification;
import gov.nih.nci.cabig.caaers.domain.report.Recipient;
import gov.nih.nci.cabig.caaers.domain.report.ReportDefinition;
import gov.nih.nci.cabig.caaers.domain.report.Report;
import gov.nih.nci.cabig.caaers.domain.report.RoleBasedRecipient;
import gov.nih.nci.cabig.caaers.domain.report.ScheduledEmailNotification;
import gov.nih.nci.cabig.caaers.domain.report.ScheduledNotification;
import gov.nih.nci.cabig.caaers.domain.report.TimeScaleUnit;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;


public class ReportDaoStub extends ReportDao {

	HashMap<Object,Report> map = new HashMap<Object, Report>();

	public ReportDaoStub() {
		init(-444);
		init(-885);
	}
	public void init(int reportId){
		Report rs = getDummyReportSchedule(reportId);
		map.put(rs.getName() + reportId, rs);

	}
	@Override
	public Report getById(int id) {
		logger.debug("ReportScheduleDAOStub : getById(" + id +")");
		for(Report rs : map.values()){
			if(rs.getId() == id) return rs;
		}
		logger.debug("ReportScheduleDAOStub : getById(returning NULL )");
		return null;
	}



	/* (non-Javadoc)
	 * @see gov.nih.nci.cabig.caaers.dao.ReportScheduleDao#save(gov.nih.nci.cabig.caaers.helper.ReportSchedule)
	 */
	@Override
	public void save(Report rs) {
		logger.debug("ReportDaoStub : save()\r\n" + String.valueOf(rs));
		map.put(rs.getName(), rs);
	}


	public Report getDummyReportSchedule(final int reportId){

		ReportDefinition rct = null;
		ExpeditedAdverseEventReport aeReport = new ExpeditedAdverseEventReport();
		aeReport.setId(reportId);

		Report rs = null;


		Calendar cal = GregorianCalendar.getInstance();
		Date now = new Date();

		List<Recipient> rList = new ArrayList<Recipient>();
		rList.add(new RoleBasedRecipient("Reporter"));
		rList.add(new ContactMechanismBasedRecipient("<EMAIL>"));

		NotificationBodyContent content = new NotificationBodyContent();
		content.setBody("This is my body");

		List<ScheduledNotification> snfList = new ArrayList<ScheduledNotification>();
		List<PlannedNotification> pnfList = new ArrayList<PlannedNotification>();



		rct = new ReportDefinition();
		rct.setDescription("a rct description");
		rct.setDuration(5);
		rct.setId(-333);
		rct.setName("24 Hr 5Day report");
		rct.setTimeScaleUnitType(TimeScaleUnit.MINUTE);
		rct.setPlannedNotifications(pnfList);


		rs = new Report(){
			int callCount = 0;
			public ReportStatus getStatus(){
				callCount++;
				if(reportId == -885 && callCount > 1)
					return ReportStatus.COMPLETED;
				return super.getStatus();
			}
		};
		rs.setStatus(ReportStatus.PENDING);
		//rs.setName("24Hour5Day("+ reportId+")");
		rs.setCreatedOn(new Date());
		rs.setId(reportId);
{'fraction_non_alphanumeric': 0.13352104327208061, 'fraction_numerical': 0.006224066390041493, 'mean_word_length': 5.180402930402931, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6081341', 'n_tokens_mistral': 2577, 'n_tokens_neox': 2402, 'n_words': 377}