private void addRowToMappGrid(DocumentCategoryConfigShortVo docCat) { if (docCat == null) return; DynamicGridRow nRow = form.lyrMain().tabByCategory().dyngrdMapps().getRows().newRow(); nRow.setCollapsedImage(form.getImages().Core.TemplateReport); nRow.setExpandedImage(form.getImages().Core.TemplateReport); // nRow.setSelectable(false); DynamicGridCell nCell = nRow.getCells().newCell(getColumn(form.lyrMain().tabByCategory().dyngrdMapps(), COLUMN_SELECT), DynamicCellType.BOOL); nCell.setAutoPostBack(true); nCell = nRow.getCells().newCell(getColumn(form.lyrMain().tabByCategory().dyngrdMapps(), COLUMN_NAME), DynamicCellType.LABEL); nCell.setValue(docCat.getTemplateIsNotNull() ? docCat.getTemplate().getName() : ""); nRow.setValue(docCat); addSpecialitiesRow(nRow, docCat.getSpecialty()); rebindCombos(nRow); }
private TemplateBoRefVoCollection getTemplateBoRefFromMappGrid() { DynamicGridRowCollection rows = form.lyrMain().tabByCategory().dyngrdMapps().getRows(); if (rows.size() == 0) return null; TemplateBoRefVoCollection result = new TemplateBoRefVoCollection(); for (int i = 0; i < rows.size(); i++) { if (rows.get(i).getValue() instanceof DocumentCategoryConfigShortVo) { result.add(((DocumentCategoryConfigShortVo) rows.get(i).getValue()).getTemplate()); } } return result; }
private void addAllAvailable() { tabByCategoryContainer tab = form.lyrMain().tabByCategory(); for (int i = 0; i < tab.dyngrdAvailableRep().getRows().size(); i++) { DynamicGridRowCollection templates = tab.dyngrdAvailableRep().getRows().get(i).getRows(); if (templates != null) { for (int j = 0; j < templates.size(); j++) { DocumentCategoryConfigShortVo docCat = new DocumentCategoryConfigShortVo(); docCat.setTemplate((TemplateForPatientDocumentVo) templates.get(j).getValue()); docCat.setCategory(tab.grdDocCat().getValue()); addRowToMappGrid(docCat); } } } tab.dyngrdAvailableRep().getRows().clear(); updateControlsState(); }
public DocumentCategoryConfigShortVo save(DocumentCategoryConfigShortVo record) throws StaleObjectException, ForeignKeyViolationException { if (!record.isValidated()) throw new DomainRuntimeException("Unable to save a record that is not validated"); DomainFactory factory = getDomainFactory(); if (!record.getID_DocumentCategoryConfigIsNotNull()) { String count = "select count(dcc.id) from DocumentCategoryConfig as dcc left join dcc.template as tem where (tem.id = :templateId)"; long configs = factory.countWithHQL(count, new String[] { "templateId" }, new Object[]{record.getTemplate().getID_TemplateBo()}); if (configs > 0) { throw new StaleObjectException(null); } } DocumentCategoryConfig dccDO = DocumentCategoryConfigShortVoAssembler.extractDocumentCategoryConfig(factory, record); factory.save(dccDO); return DocumentCategoryConfigShortVoAssembler.create(dccDO); }
private void populateReports(DocumentCategoryConfigShortVoCollection documentCategoryConfigShortVoCollection) { form.dyngrdReports().getRows().clear(); if (documentCategoryConfigShortVoCollection == null) { //wdev-12285 engine.showMessage("No matching templates found."); //--------- return; } if(documentCategoryConfigShortVoCollection.size() == 0) //wdev-12285 engine.showMessage("No matching templates found."); //wdev-12285 else //wdev-12285 for (int i = 0; i < documentCategoryConfigShortVoCollection.size(); i++) { DocumentCategoryConfigShortVo voReportList = documentCategoryConfigShortVoCollection.get(i); addReport(voReportList); } }
private void addTemplates(DocumentCategoryConfigShortVo voReportList, DynamicGridRow reportRow) { if(voReportList == null || voReportList.getTemplate() == null || voReportList.getTemplate().getReport() == null) throw new CodingRuntimeException("Cannot add a row with null template or null report."); if(reportRow == null) return; DynamicGridRow templateRow = reportRow.getRows().newRow(); templateRow.setValue(voReportList); templateRow.setCollapsedImage(form.getImages().Core.TemplateReport); templateRow.setExpandedImage(form.getImages().Core.TemplateReport); DynamicGridCell cellTemplateName = createCell(templateRow, getColumn(COLUMN_NAME)); if(cellTemplateName != null) cellTemplateName.setValue(voReportList.getTemplate().getName()); if(voReportList.getTemplate().getReport().getImsIdIsNotNull() && voReportList.getTemplate().getReport().getImsId().intValue() > 0) { templateRow.setTextColor(Color.Blue); } }
private void populateScreenFromData(DocumentCategoryConfigShortVo data) { clearInstanceControls(); if (data == null) return; form.lyrMain().tabByTemplate().cmbDocCat().setValue(data.getCategory()); form.lyrMain().tabByTemplate().ccSpecialty().setValue(data.getSpecialty()); }
private void addSelectedAvailable() { tabByCategoryContainer tab = form.lyrMain().tabByCategory(); DynamicGridColumn colSel = getColumn(tab.dyngrdAvailableRep(), COLUMN_SELECT); for (int i = 0; i < tab.dyngrdAvailableRep().getRows().size(); i++) { DynamicGridRowCollection templates = tab.dyngrdAvailableRep().getRows().get(i).getRows(); if (templates != null) { for (int j = 0; j < templates.size(); j++) { if (Boolean.TRUE.equals(templates.get(j).getCells().get(colSel).getValue())) { DocumentCategoryConfigShortVo docCat = new DocumentCategoryConfigShortVo(); docCat.setTemplate((TemplateForPatientDocumentVo) templates.get(j).getValue()); docCat.setCategory(tab.grdDocCat().getValue()); addRowToMappGrid(docCat); } } } } searchDC(false); updateControlsState(); }
private DocumentCategoryConfigShortVoCollection populateDataFromScreenDC() { DynamicGridRowCollection rows = form.lyrMain().tabByCategory().dyngrdMapps().getRows(); DynamicGridColumn colSpec = getColumn(form.lyrMain().tabByCategory().dyngrdMapps(), COLUMN_NAME); if (rows.size() == 0) return null; DocumentCategoryConfigShortVoCollection result = new DocumentCategoryConfigShortVoCollection(); for (int i = 0; i < rows.size(); i++) { DocumentCategoryConfigShortVo docCat = (DocumentCategoryConfigShortVo) rows.get(i).getValue(); docCat.setSpecialty(null); DynamicGridRowCollection specR = rows.get(i).getRows(); if (specR != null && specR.size() > 0) { docCat.setSpecialty(new SpecialtyCollection()); for (int j = 0; j < specR.size(); j++) { Object spec = specR.get(j).getCells().get(colSpec).getValue(); if (spec instanceof Specialty) { docCat.getSpecialty().add((Specialty) spec); } } } result.add(docCat); } return result; }
public DocumentCategoryConfigShortVo getDocCatConfig(TemplateBoRefVo template) { if (!template.getID_TemplateBoIsNotNull()) throw new DomainRuntimeException("Unable to retrive document category config for template with null id!"); String hql = "select dcc from DocumentCategoryConfig as dcc left join dcc.template as temp where dcc.isRIE is null and temp.id=:idTemp"; List<?> dos = getDomainFactory().find(hql, "idTemp", template.getID_TemplateBo()); if (dos == null || dos.size() == 0) return null; return DocumentCategoryConfigShortVoAssembler.createDocumentCategoryConfigShortVoCollectionFromDocumentCategoryConfig(dos).get(0); }
@Override protected void onBtnGenerateClick() throws ims.framework.exceptions.PresentationLogicException { String[] str = validateUIRules(); if (str != null && str.length > 0) { engine.showErrors(str); return; } PatientDocumentVo doc = savePatientDocuments("DummyFileName"); if (doc == null) return; String fileName = createReport(((DocumentCategoryConfigShortVo) form.dyngrdReports().getValue()).getTemplate(),doc); if (fileName == null) { domain.deleteDocument(doc); return; } doc.getServerDocument().setFileName(fileName); doc.validate(); try { form.getGlobalContext().Core.setPatientCorrespondence(domain.savePatientDocument(doc)); //WDEV-12643 fillDocumentWorklistSearchCriteria(); } catch (StaleObjectException e) { domain.deleteDocument(doc); deleteFile(getWorkAreaPath() + fileName);//WDEV-13366 e.printStackTrace(); } engine.close(DialogResult.OK); }
private void addReport(DocumentCategoryConfigShortVo voReportList) { if(voReportList == null || voReportList.getTemplate() == null) return; DynamicGridRow reportRow = checkIfReportIsAlreadyAdded(voReportList.getTemplate()); if(reportRow == null) { reportRow = createReportRow(voReportList.getTemplate()); reportRow.setExpanded(true); //wdev-13915 } addTemplates(voReportList, reportRow); }