private void search() { clearGridExternalResource(); clearDetailsFields(); ExternalResourceVoCollection externalVoCol = domain.getExternalResources(form.cmbResourceType().getValue(), form.txtName().getValue(), form.cmbHCPType().getValue(), form.cmbStatus().getValue()); if( externalVoCol == null || externalVoCol.size() == 0) { return; } populateExternalResourceGrid(externalVoCol); if( form.getLocalContext().getSelectedExternalResourceIsNotNull()) { form.grdExternalResource().setValue(form.getLocalContext().getSelectedExternalResource()); grdExternalResourceSelectionChanged(); } updateControlsState(); }
private void populateExternalResourceGrid(ExternalResourceVoCollection externalVoCol) { if( externalVoCol == null ) return; for( int i = 0; i < externalVoCol.size();i++ ) { ExternalResourceVo tempVo = externalVoCol.get(i); if( tempVo != null ) { grdExternalResourceRow rowextres = form.grdExternalResource().getRows().newRow(); rowextres.setColumnResourceType(tempVo.getExternalResourceTypeIsNotNull() ? tempVo.getExternalResourceType().getText():""); rowextres.setColumnHCPType(tempVo.getHCPTypeIsNotNull() ? tempVo.getHCPType().getText():null); rowextres.setColumnName(tempVo.getResourcename()); rowextres.setColumnAddress(tempVo.getResourceAddress().getLine1()+ " " + (tempVo.getResourceAddress().getLine2IsNotNull() ? tempVo.getResourceAddress().getLine2():"") + " " + (tempVo.getResourceAddress().getLine3IsNotNull() ? tempVo.getResourceAddress().getLine3():"")); rowextres.setColumnCounty(tempVo.getResourceAddress().getCountyIsNotNull() ? tempVo.getResourceAddress().getCounty().getText():""); rowextres.setColumnWorkPhone(tempVo.getResourceAddress().getPhoneIsNotNull() ? tempVo.getResourceAddress().getPhone():""); rowextres.setColumnStatus(tempVo.getResourceStatusIsNotNull() ? tempVo.getResourceStatus().getText():""); rowextres.setValue(tempVo); } } }
private void search() { form.grdExternalResource().getRows().clear(); ExternalResourceVoCollection externalVoCol = domain.getExternalResources(form.cmbResourceType().getValue(), form.txtName().getValue(), form.cmbHCPType().getValue(), form.cmbStatus().getValue()); if (externalVoCol == null || externalVoCol.size() == 0) { engine.showMessage("No records found !"); return; } populateExternalResourceGrid(externalVoCol); }
private void populateExternalResourceGrid(ExternalResourceVoCollection externalVoCol) { if (externalVoCol == null) return; for (int i = 0; i < externalVoCol.size(); i++) { ExternalResourceVo tempVo = externalVoCol.get(i); if (tempVo != null) { grdExternalResourceRow rowExternalResGrid = form.grdExternalResource().getRows().newRow(); rowExternalResGrid.setColumnResourceType(tempVo.getExternalResourceType().getText()); rowExternalResGrid.setColumnHCPType(tempVo.getHCPTypeIsNotNull() ? tempVo.getHCPType().getText() : null); rowExternalResGrid.setColumnName(tempVo.getResourcename()); if (tempVo.getResourceAddressIsNotNull()) { rowExternalResGrid.setColumnAddress(tempVo.getResourceAddress().getLine1() + " " + (tempVo.getResourceAddress().getLine2IsNotNull() ? tempVo.getResourceAddress().getLine2() : "") + " " + (tempVo.getResourceAddress().getLine3IsNotNull() ? tempVo.getResourceAddress().getLine3() : "")); rowExternalResGrid.setColumnCounty(tempVo.getResourceAddress().getCounty() != null ? tempVo.getResourceAddress().getCounty().getText() : null); rowExternalResGrid.setColumnWorkPhone(tempVo.getResourceAddress().getPhone()); } rowExternalResGrid.setColumnStatus(tempVo.getResourceStatus().getText()); rowExternalResGrid.setValue(tempVo); } } }
public ExternalResourceVoCollection getExternalResources(ExternalResourceType externalResourceType, String name, HcpDisType hcpType, PreActiveActiveInactiveStatus status) { ArrayList<String> names = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String prepend = " where "; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from ExternalResource as er "); if (externalResourceType != null) { hql.append(prepend + " er.externalResourceType.id = :resourceType "); names.add("resourceType"); values.add(externalResourceType.getID()); prepend = " and "; } if (name != null) { hql.append(prepend + " upper(er.resourcename) like :name"); names.add("name"); values.add(name.toUpperCase() + "%"); prepend = " and "; } if (hcpType != null) { hql.append(prepend + " er.hCPType.id = :idHcpType "); names.add("idHcpType"); values.add(hcpType.getID()); prepend = " and "; } if (status != null) { hql.append(prepend + " er.resourceStatus.id = :idStatus "); names.add("idStatus"); values.add(status.getID()); } hql.append(" order by er.systemInformation.creationDateTime asc"); List<?> extresources = factory.find(hql.toString(), names, values); return ExternalResourceVoAssembler.createExternalResourceVoCollectionFromExternalResource(extresources); }