/** * Returns a list of all active order entry templates */ public OrderEntryTemplateShortVoCollection listActiveOrderEntryTemplatesForLocationAndRole(ILocation location, AppRoleRefVo role) { if(location == null) return null; DomainFactory factory = getDomainFactory(); DomainObject locRecord = factory.getDomainObject(Location.class, location.getID()); List templates; if(locRecord instanceof LocSite) { templates = listOrderEntryTemplates(factory, locRecord, role); } else { //record is of type location go back up the hierarchy until the record's parentLocation is of type LocSite //when it is do the same call as above Location doLocation = (Location) locRecord; if(doLocation.getParentLocation() instanceof LocSite) templates = listOrderEntryTemplates(factory, doLocation.getParentLocation(), role); else { while(!(doLocation.getParentLocation() instanceof LocSite)) doLocation = doLocation.getParentLocation(); templates = listOrderEntryTemplates(factory, doLocation.getParentLocation(), role); } } return OrderEntryTemplateShortVoAssembler.createOrderEntryTemplateShortVoCollectionFromOrderEntryTemplate(templates); }
public OrderEntryTemplateShortVoCollection listTemplatesUsingInvestigation(InvestigationIndexRefVo invIndex) { if (invIndex == null) throw new CodingRuntimeException("parameter invIndex is null in method listTemplatesUsingInvestigation"); DomainFactory factory = getDomainFactory(); return OrderEntryTemplateShortVoAssembler.createOrderEntryTemplateShortVoCollectionFromOrderEntryTemplate(getAssociatedItems(factory, invIndex.getID_InvestigationIndex())); }
/** * lists order entry templates */ public ims.ocrr.vo.OrderEntryTemplateShortVoCollection listOrderEntryTemplates(ims.ocrr.vo.OrderEntryTemplateListSearchCriteriaVo searchCriteria) { DomainFactory factory = getDomainFactory(); String hql = " from OrderEntryTemplate oet "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if(searchCriteria != null) { if(searchCriteria.getNameIsNotNull()) { condStr.append(andStr + " upper(oet.formName) like :name"); markers.add("name"); values.add("%" + searchCriteria.getName().toUpperCase() + "%"); andStr = " and "; } if(searchCriteria.getStatusIsNotNull()) { condStr.append(andStr + " oet.activeStatus = :status"); markers.add("status"); values.add(getDomLookup(searchCriteria.getStatus())); andStr = " and "; } if(searchCriteria.getLocationIsNotNull()) { hql = "select oet from OrderEntryTemplate oet join oet.templatesLocations loc "; condStr.append(andStr + " (loc.location in (:location) and loc.isActive = :active) "); markers.add("location"); markers.add("active"); values.add(LocSiteShortVoAssembler.extractLocSite(factory, searchCriteria.getLocation())); values.add(Boolean.TRUE); andStr = " and "; } } if(condStr.length() > 0) { hql += " where "; hql += condStr.toString(); } return OrderEntryTemplateShortVoAssembler.createOrderEntryTemplateShortVoCollectionFromOrderEntryTemplate(factory.find(hql.toString(), markers, values)); }