public SpecimenCollectionListConfigDetailsVoCollection listSpecimenCollectionDetails(SpecimenCollectionMethod type, Date date) { if(type == null || date == null) throw new CodingRuntimeException("Coding Error = type or date is null (listSpecimenCollectionDetails) "); DayOfWeek dayInst = getDayOfWeek(date); DomainFactory factory = getDomainFactory(); List cfgSpecs = factory.find("from SpecimenCollectionListConfigDetails detail where detail.dayOfWeek = :dayOfWeekInst and id in (select header.detail.id from SpecimenCollectionListConfig header where header.listType = :listType)", new String[]{"dayOfWeekInst","listType"}, new Object[] { getDomLookup(dayInst),getDomLookup(type)}); SpecimenCollectionListConfigDetailsVoCollection voCollSpecimenListConfigDetail = null; if(cfgSpecs != null && cfgSpecs.size() > 0) voCollSpecimenListConfigDetail = SpecimenCollectionListConfigDetailsVoAssembler.createSpecimenCollectionListConfigDetailsVoCollectionFromSpecimenCollectionListConfigDetails(cfgSpecs); return voCollSpecimenListConfigDetail; }
private DayOfWeek getDayOfWeek(Date date) { if(date == null) throw new CodingRuntimeException("Coding Error = date is null (getDayOfWeek) "); DomainFactory factory = getDomainFactory(); List hols = factory.find("from PublicHolidays hol where hol.date = :date", new String[]{"date"}, new Object[] {date.getDate()}); if(hols != null && hols.size() > 0) return DayOfWeek.PUBLICHOLIDAY; DayOfWeek inst = null; ims.framework.utils.DayOfWeek day = date.getDayOfWeek(); if(day.equals(ims.framework.utils.DayOfWeek.MONDAY)) inst = DayOfWeek.MONDAY; else if(day.equals(ims.framework.utils.DayOfWeek.TUESDAY)) inst = DayOfWeek.TUESDAY; else if(day.equals(ims.framework.utils.DayOfWeek.WEDNESDAY)) inst = DayOfWeek.WEDNESDAY; else if(day.equals(ims.framework.utils.DayOfWeek.THURSDAY)) inst = DayOfWeek.THURSDAY; else if(day.equals(ims.framework.utils.DayOfWeek.FRIDAY)) inst = DayOfWeek.FRIDAY; else if(day.equals(ims.framework.utils.DayOfWeek.SATURDAY)) inst = DayOfWeek.SATURDAY; else if(day.equals(ims.framework.utils.DayOfWeek.SUNDAY)) inst = DayOfWeek.SUNDAY; return inst; }
private SpecimenCollectionListConfigDetailsVoCollection populateSpecimenCollectionListConfigDetails() { GenForm.lyrSpecColConfigLayer.tabSpecCollectionConfigContainer.grdSpecimenCollectionRow row; SpecimenCollectionListConfigDetailsVoCollection voCollListConfigDetails = new SpecimenCollectionListConfigDetailsVoCollection(); for (int i = 0; i < form.lyrSpecColConfig().tabSpecCollectionConfig().grdSpecimenCollection().getRows().size(); i++) { row = form.lyrSpecColConfig().tabSpecCollectionConfig().grdSpecimenCollection().getRows().get(i); if (row.getcolMonday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.MONDAY); } if (row.getcolTuesday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.TUESDAY); } if (row.getcolWednesday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.WEDNESDAY); } if (row.getcolThursday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.THURSDAY); } if (row.getcolFriday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.FRIDAY); } if (row.getcolSaturday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.SATURDAY); } if (row.getcolSunday()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.SUNDAY); } if (row.getcolExceptionDays()) { populateCollectionWithRowDetail(row, voCollListConfigDetails, DayOfWeek.PUBLICHOLIDAY); } } return voCollListConfigDetails; }