protected void onImbSearchClick() throws PresentationLogicException { clearSearchGrid(); setDefaultImage(null, true); String name = form.lyrDrawing().tabImageSearch().txtImageNameSearch().getValue(); if (name != null) name = name.trim(); //WDEV-1736 - users should be able to search without entering any search criteria /*if (name == null || name.equals("")) { engine.showMessage("Please enter an Image Name"); form.lyrDrawing().tabImageSearch().txtImageNameSearch().setFocus(); return; }*/ if (name != null && name.length() > 0) { GroupSearchCriteriaEnumeration criteria = form.lyrDrawing().tabImageSearch().GroupSearchCriteria().getValue(); if (criteria != null) { if (criteria.equals(GroupSearchCriteriaEnumeration.rdoBeginsWith)) { name += "%"; } if (criteria.equals(GroupSearchCriteriaEnumeration.rdoContains)) { name = "%" + name + "%"; } } } DrawingGraphicImageVoCollection voColl = domain.listGraphicImages(name, PreActiveActiveInactiveStatus.ACTIVE); if (voColl == null || voColl.size() == 0) engine.showMessage("No Drawing Configurations found for the Search Criteria Provided"); displayListImages(voColl); }
private void displayListImages(DrawingGraphicImageVoCollection voColl) { for (int i = 0; i < voColl.size(); i++) { DrawingGraphicImageVo voDGImage = voColl.get(i); GenForm.lyrDrawingLayer.tabImageSearchContainer.grdImagesSearchRow row = form.lyrDrawing().tabImageSearch().grdImagesSearch().getRows().newRow(); row.setcolImageName(voDGImage.getImageName()); row.setcolStatus(voDGImage.getImageStatusIsNotNull() ? voDGImage.getImageStatus().toString() : ""); row.setcolVersionNo(voDGImage.getVersionNumberIsNotNull() ? voDGImage.getVersionNumber().toString() : ""); row.setTooltip(getTooltip(voDGImage)); row.setValue(voDGImage); } }
public DrawingGraphicImageVoCollection listGraphicImages(String name, ims.core.vo.lookups.PreActiveActiveInactiveStatus status) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from DrawingGraphicImage dgi"); java.util.ArrayList markers = new java.util.ArrayList(); java.util.ArrayList values = new java.util.ArrayList(); String clause = " where "; if(name != null && !name.equals("")) { hql.append(clause); hql.append("upper(dgi.imageName) like :imgName"); markers.add("imgName"); values.add(name.toUpperCase()); clause = " and "; } if(status != null) { hql.append(clause); hql.append("dgi.imageStatus = :imgStat"); markers.add("imgStat"); values.add(getDomLookup(status)); clause = " and "; } List graphicImagesList = factory.find(hql.toString(), markers, values); return DrawingGraphicImageVoAssembler.createDrawingGraphicImageVoCollectionFromDrawingGraphicImage(graphicImagesList); }