@Override protected void onImbSearchClick() throws ims.framework.exceptions.PresentationLogicException { if(form.txtUser().getValue() == null || form.txtUser().getValue().equals("")) { engine.showErrors(new String[] {"Name is mandatory"}); return; } form.grdUsers().getRows().clear(); UserDTOVoCollection voCollUser = domain.listUserByName(form.txtUser().getValue()); if(voCollUser != null && voCollUser.size() > 0) { for (int i = 0; i < voCollUser.size(); i++) { UserDTOVo voUser = voCollUser.get(i); grdUsersRow row = form.grdUsers().getRows().newRow(); row.setColName(voUser.getUserName()); row.setValue(voUser); } } else engine.showMessage("No matching records found"); updateControlsState(); }
/** * listUserByName */ public ims.admin.vo.UserDTOVoCollection listUserByName(String name) { if (name == null) throw new CodingRuntimeException("name cannot be null in method listUserByName"); UserDTOVoCollection voCollUsers = new UserDTOVoCollection(); name = name.replaceAll("[^a-zA-Z]", ""); name = name.toUpperCase(); name += "?"; User user = (User) getDTOInstance(User.class); user.Filter.clear(); user.Filter.User = name; user.list(); if(user.DataCollection.count() > 0) { for(int i=0;i<user.DataCollection.count(); i++) { UserRecord rec = user.DataCollection.get(i); UserDTOVo voUser = new UserDTOVo(); voUser.setUserName(rec.User); voCollUsers.add(voUser); } } return voCollUsers; }
/** * listUserByName - dummy implementation */ public UserDTOVoCollection listUserByName(String name) { return null; }