/** * 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())); }
/** * This method will show Templates/Profiles that are currently using the * investigation hence it could not be made inactive * * @param errors */ private void displayConflictingRecords(ErrorCode[] errors) { boolean tempError = false; boolean profError = false; if (errors != null && errors.length > 0) { for (int i = 0; i < errors.length; i++) { if (errors[i].equals(ErrorCode.ACTIVE_TEMPLATE_USING_INV)) tempError = true; if (errors[i].equals(ErrorCode.ACTIVE_PROFILE_USING_INV)) profError = true; } } String displayMessage = ""; if (tempError == true) { OrderEntryTemplateShortVoCollection templates = domain.listTemplatesUsingInvestigation(form.getGlobalContext().OCRR.getSelectedTest()); if (templates != null && templates.size() > 0) { displayMessage += "The following template(s) are using this Investigation, please remove the item from each template before making the Investigation inactive" + "\r"; for (int i = 0; i < templates.size(); i++) { displayMessage += "\r" + templates.get(i).getDescription(); } } } if (profError == true) { InvestigationIndexShortVoCollection profiles = domain.listProfilesUsingInvestigation(form.getGlobalContext().OCRR.getSelectedTest()); if (profiles != null && profiles.size() > 0) { displayMessage += (tempError ? "\r" : "") + "The following profile(s) are using this Investigation, please remove the item from each profile before making the Investigation inactive" + "\r"; for (int i = 0; i < profiles.size(); i++) { displayMessage += "\r" + profiles.get(i).getDescription(); } } } engine.showMessage(displayMessage); }
private void search() { form.grdDetails().getRows().clear(); OrderEntryTemplateListSearchCriteriaVo searchCriteria = form.getGlobalContext().OCRR.getOrderEntryTemplateListSearchCriteria(); if(searchCriteria == null) return; if(!isValidSearchCriteria()) { form.getGlobalContext().OCRR.setOrderEntryTemplateListSearchCriteria(null); engine.showMessage("Please Enter Some Search Criteria"); return; } OrderEntryTemplateShortVoCollection records = domain.listOrderEntryTemplates(searchCriteria); if(records != null) { records.sort(); for(int x = 0; x < records.size(); x++) { OrderEntryTemplateShortVo item = records.get(x); GenForm.grdDetailsRow row = form.grdDetails().getRows().newRow(form.getGlobalContext().OCRR.getSelectedOrderEntryTemplateIDIsNotNull() && form.getGlobalContext().OCRR.getSelectedOrderEntryTemplateID().equals(item.getID_OrderEntryTemplate())); row.setValue(item); row.setcolImage(form.getImages().OCRR.OrderEntryTemplate); row.setcolName(item.getFormName()); if(item.getActiveStatusIsNotNull()) row.setcolStatus(item.getActiveStatus().getText()); } if(form.grdDetails().getSelectedRowIndex() < 0) form.getGlobalContext().OCRR.setSelectedOrderEntryTemplateID(null); //--------------------------------------------- if(records.size() == 0) engine.showMessage("No Records Found!!!"); //---------------------------------------------- } setContextMenu(); }