private AppUserShortWithNameVoCollection searchUsersBySurname(String surname) throws CodingRuntimeException { if (surname == null) { // Leave throw so that the users are not cleared when an empty search is made throw new CodingRuntimeException("Search citeria can not be null"); } // Set the filter VO needed for the search AppUserShortVo filterVo = new AppUserShortVo(); filterVo.setUserRealName(surname); // Retrieve the users (list from domain) try { return domain.searchUsers(filterVo); } catch (DomainInterfaceException exception) { engine.showMessage(exception.getMessage()); return null; } }
private void searchAppUser() { if (form.txtUserName().getValue() == "") engine.showMessage("Please enter a user name or part to search"); else { form.grdUsers().getRows().clear(); AppUserShortVo voFilter = new AppUserShortVo(); voFilter.setUsername(form.txtUserName().getValue()); AppUserShortVoCollection voCollAppusers = domain.listAppUsers(voFilter); if ((voCollAppusers != null) && (voCollAppusers.size()>0)) { for (int i=0;i<voCollAppusers.size();i++) { GenForm.grdUsersRow userRow = form.grdUsers().getRows().newRow(); userRow.setValue(voCollAppusers.get(i)); userRow.setcolUserName(voCollAppusers.get(i).getUsername()); userRow.setcolRealName(voCollAppusers.get(i).getUserRealName()); } } else engine.showMessage("No users found for : " + form.txtUserName().getValue()); } }
@Override protected void onQmbUserTextSubmited(String username) throws PresentationLogicException { form.qmbUser().clear(); AppUserShortVoCollection coll = domain.getAppUsers(username +"%"); coll.sort(new UserComparator(SortOrder.ASCENDING));//WDEV-17275 if(coll != null && coll.size() > 0) { for(AppUserShortVo item : coll) { form.qmbUser().newRow(item, item.getUsername()); } if(coll.size() == 1) { form.qmbUser().setValue(coll.get(0)); } else { form.qmbUser().showOpened(); } } }
public int compare(Object ob1, Object ob2) { //PersonName userName1 = null; String userName2 = null; String userName1 = null; if(ob1 instanceof AppUserShortVo ) { AppUserShortVo user1 = (AppUserShortVo)ob1; userName1 =user1.getUsernameIsNotNull() ? user1.getUsername().toUpperCase():null; } if(ob2 instanceof AppUserShortVo) { AppUserShortVo user2 = (AppUserShortVo)ob2; userName2 = user2.getUsernameIsNotNull() ? user2.getUsername().toUpperCase():null; } if(userName1 != null ) return userName1.compareTo(userName2)*direction; if(userName2 != null) return (-1)*direction; return 0; }
@Override protected void onDyngrdActionsCellTextSubmited(DynamicGridCell cell) { cell.getItems().clear(); AppUserShortVo appUserFilter = new AppUserShortVo(); appUserFilter.setUsername(cell.getTypedText()); AppUserShortVoCollection users = domain.listAppUsers(appUserFilter); if (users != null && users.size() > 0) { for (int i = 0; i < users.size(); i++) { DynamicGridCellItem item = cell.getItems().newItem(users.get(i).getUserRealName() + " (" + users.get(i).getUsername() + ")"); item.setIdentifier(users.get(i)); } if (users.size() == 1) { cell.setValue(users.get(0).getUserRealName() + " (" + users.get(0).getUsername() + ")"); cell.setIdentifier(users.get(0)); } else if (users.size() > 1) cell.showOpened(); cell.getRow().setIdentifier(cell.getIdentifier()); } }
protected void onQmbUserTextSubmited(String value) throws PresentationLogicException { if (value != null) { AppUserShortVo appuser = new AppUserShortVo(); appuser.setUsername(value); AppUserShortVoCollection voColl = domain.listUsers(appuser); form.qmbUser().clear(); for (AppUserShortVo appUser : voColl) { form.qmbUser().newRow(appUser, appUser.getUsername().toString()); } if (voColl.size() == 1) form.qmbUser().setValue(voColl.get(0)); else if (voColl.size() > 1) form.qmbUser().showOpened(); } }
@Override protected void onQmbPDSBackofficeNotificationUserTextSubmited(String value) throws PresentationLogicException { if (value != null) { AppUserShortVo appuser = new AppUserShortVo(); appuser.setUsername(value); AppUserShortVoCollection voColl = domain.listUsers(appuser); form.qmbPDSBackofficeNotificationUser().clear(); for (AppUserShortVo appUser : voColl) { form.qmbPDSBackofficeNotificationUser().newRow(appUser, appUser.getUsername().toString()); } if (voColl.size() == 1) form.qmbPDSBackofficeNotificationUser().setValue(voColl.get(0)); else if (voColl.size() > 1) form.qmbPDSBackofficeNotificationUser().showOpened(); } }
public UserDictionaryVoCollection listUserDictionary(AppUserShortVo user) { DomainFactory factory = getDomainFactory(); String hql = " from UserDictionary userDictionary "; StringBuffer condStr = new StringBuffer(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); condStr.append(" where userDictionary.user.id =:id "); markers.add("id"); values.add(user.getID_AppUser()); List list = factory.find(hql, markers, values); return UserDictionaryVoAssembler.createUserDictionaryVoCollectionFromUserDictionary(list); }
public AppUserShortVoCollection listUsers() { AppUserShortVo filter = new AppUserShortVo(); filter.setIsActive(new Boolean(true)); ApplicationUsers userAdmin = (ApplicationUsers) getDomainImpl(ApplicationUsersImpl.class); return userAdmin.listAppUsers(filter); }
private void populateUsers(AppUserShortVoCollection users) { // Clear combobox form.qmbUsers().clear(); // Terminate function if collection is null if (users == null || users.size() == 0) { form.qmbUsers().showOpened(); return; } for (int i = 0; i < users.size(); i ++) { AppUserShortVo user = users.get(i); // Skip null users if (user == null) continue; form.qmbUsers().newRow(user, user.getUsername()); } if (users.size() == 1) form.qmbUsers().setValue(users.get(0)); else form.qmbUsers().showOpened(); }
private void populateUsers(AppUserShortVoCollection users) { // Clear combobox form.qmbUsers().clear(); // Terminate function if collection is null if (users == null) { form.qmbUsers().showOpened(); return; } for (int i = 0; i < users.size(); i ++) { AppUserShortVo user = users.get(i); // Skip null users if (user == null) continue; form.qmbUsers().newRow(user, user.getUsername()); } if (users.size() == 1) { form.qmbUsers().setValue(users.get(0)); } else if (users.size() > 1) { form.qmbUsers().showOpened(); } }
public AppUserShortVo getAppUsersShort(AppUserShortVo voRef) { if (voRef == null) return null; DomainFactory factory = getDomainFactory(); AppUser domAppUser = (AppUser)factory.getDomainObject(AppUser.class, voRef.getID_AppUser()); return AppUserShortVoAssembler.create(domAppUser); }
public AppUserShortVo getAppUserShortVo(AppUserRefVo refVo) { if (refVo == null) throw new RuntimeException("Cannot get AppUserShortVo for null AppUserShortRefVo"); AppUser doAppUser = (AppUser) getDomainFactory().getDomainObject(AppUser.class, refVo.getID_AppUser()); return AppUserShortVoAssembler.create(doAppUser); }
private void checkForDefaultDictionary() { AppUserVo appuser = new AppUserVo(); AppUserShortVo currentUser = new AppUserShortVo(); HcpLiteVo hcpUser = (HcpLiteVo)domain.getHcpLiteUser(); if (hcpUser != null) { appuser.setUsername(hcpUser.getIHcpName()); AppUserShortVoCollection coll = domain.listAppUsers(appuser); if(coll != null && coll.size() > 0) { currentUser = coll.get(0); UserDictionaryVoCollection dictionaryColl = domain.listUserDictionary(currentUser); UserDictionaryVo dictionary = null; if (dictionaryColl != null && dictionaryColl.size() > 0) { dictionary = dictionaryColl.get(0); GlobalDictionaryVoCollection globalsColl = domain.listGlobalDictionary(currentUser); renderDictionaryDynamicGrid(dictionary,globalsColl); } } } else { engine.showMessage("Current loggin user don't have setup an user dictionary\nDo you want to setup an User Dictionary now?","Confirmation", MessageButtons.YESNO, MessageIcon.QUESTION); } }
public GlobalDictionaryVoCollection listGlobalDictionary(AppUserShortVo user) { DomainFactory factory = getDomainFactory(); String hql = "select globalDictionaries from UserDictionary as userDictionary "; StringBuffer condStr = new StringBuffer(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); condStr.append(" left join userDictionary.globalDictionaries as globalDictionaries where userDictionary.user.id = :id "); markers.add("id"); values.add(user.getID_AppUser()); List list = factory.find(hql, markers, values); return GlobalDictionaryVoAssembler.createGlobalDictionaryVoCollectionFromGlobalDictionary(list); }
@Override public AppUserShortVo getApptUserShort(AppUserRefVo userId) { if (userId != null) { AppUser user = (AppUser) getDomainFactory().getDomainObject(AppUser.class,userId.getID_AppUser()); return AppUserShortVoAssembler.create(user); } return null; }