private void populateExternalPersonTree(ExternalPersonShortVo filterVo) { ExternalPersonVoCollection extPerCollVo = domain.listExternalPerson(filterVo); if (null == extPerCollVo) return; form.treExternalPerson().clear(); if (extPerCollVo.size() > 0) { for (int i = 0; i < extPerCollVo.size() ; i++) { ExternalPersonShortVo extPerVo = extPerCollVo.get(i); TreeNode newNode = form.treExternalPerson().getNodes().add(extPerVo, extPerVo.getName().toShortForm()); newNode.setCollapsedImage(form.getImages().Admin.StaffBlack); newNode.setExpandedImage(form.getImages().Admin.StaffBlack); } } else engine.showMessage("No Person found matching that criteria."); }
private void searchPerson() { clearInstanceControls(); form.getContextMenus().hideAllGenericGridMenuItems(); form.getContextMenus().hideAllLIPMenuItems(); form.getContextMenus().getLIPNewItem().setVisible(true); form.btnUpdate().setVisible(false); form.grdDetails().getRows().clear(); ExternalPersonShortVo voExtPer = new ExternalPersonShortVo(); PersonName voPerName = new PersonName(); voPerName.setSurname(form.txtSName().getValue()); voExtPer.setName(voPerName); voExtPer.setIsActive(new Boolean(form.chkActive().getValue())); ExternalPersonVoCollection voExtPerCol = domain.listExternalPerson(voExtPer); if ((null != voExtPerCol) && voExtPerCol.size() > 0) { for (int i = 0; i < voExtPerCol.size(); i++) { GenForm.grdDetailsRow row = form.grdDetails().getRows().newRow(); row.setColImage(form.getImages().Core.User); row.setName(voExtPerCol.get(i).getName().toShortForm()); row.setValue(voExtPerCol.get(i)); if (!voExtPerCol.get(i).getIsActive().booleanValue()) row.setBackColor(Color.Beige); } } else engine.showMessage("No External Person found matching this search criteria."); }
public ExternalPersonVoCollection listExternalPerson(ExternalPersonShortVo voExternalPersonFilter) { ExternalPersonAdmin impl = (ExternalPersonAdmin) getDomainImpl(ExternalPersonAdminImpl.class); return impl.listExternalPerson(voExternalPersonFilter); }
public ExternalPersonVoCollection listExternalPerson(ims.core.vo.ExternalPersonShortVo voExternalPersonFilter) { DomainFactory factory = getDomainFactory(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); StringBuffer filterString = new StringBuffer(); String andStr=""; int maxPats = ConfigFlag.DOM.PAT_SEARCH_MAX_SIZE.getValue(); java.util.List persons = null; if (voExternalPersonFilter.getNameIsNotNull() && voExternalPersonFilter.getName().getSurnameIsNotNull()) { String strSearchSurname = ""; filterString.append(andStr + " p.name.upperSurname like :surname"); markerNames.add("surname"); strSearchSurname = voExternalPersonFilter.getName().getSurname().toUpperCase().trim(); if(strSearchSurname.startsWith("*") ) { if(strSearchSurname.length() >= 11) { strSearchSurname = '%' + strSearchSurname.substring(1,11); strSearchSurname += '%'; } else { strSearchSurname = '%' + strSearchSurname.substring(1, strSearchSurname.length()); strSearchSurname += '%'; } } else { if(strSearchSurname.length() >= 10) { strSearchSurname = strSearchSurname.substring(0,10); strSearchSurname += '%'; } else { strSearchSurname += '%'; } } markerValues.add(strSearchSurname); andStr = " and "; if (voExternalPersonFilter.getIsActive()== true) { filterString.append(andStr + " p.isActive = :active"); markerNames.add("active"); markerValues.add(voExternalPersonFilter.getIsActive()); } persons = factory.find("from ims.core.generic.domain.objects.ExternalPerson p where " + filterString.toString(), markerNames, markerValues, maxPats); } else { if (voExternalPersonFilter.getIsActive()== true) { //return all active filterString.append(andStr + " p.isActive = :active"); markerNames.add("active"); markerValues.add(voExternalPersonFilter.getIsActive()); persons = factory.find("from ims.core.generic.domain.objects.ExternalPerson p where " + filterString.toString(), markerNames, markerValues, maxPats); } else { //return all persons = factory.find("from ims.core.generic.domain.objects.ExternalPerson p"); } } return ExternalPersonVoAssembler.createExternalPersonVoCollectionFromExternalPerson(persons); }