// œr private ’ protected protected void init(IWContext iwc) { this.form = new Form(); this.searchString = iwc.getParameter(this.PARAMETER_SEARCH); this.iwrb = iwc.getIWMainApplication() .getBundle(BuilderConstants.STANDARD_IW_BUNDLE_IDENTIFIER) .getResourceBundle(iwc); this.showAll = iwc.isParameterSet(this.PARAMETER_VIEW_ALL); if (iwc.isParameterSet(this.PARAMETER_CURRENT_PAGE)) { this.currentPage = Integer.parseInt(iwc.getParameter(this.PARAMETER_CURRENT_PAGE)); } // int start = currentPage * USERS_PER_PAGE; try { String useUserPks = (String) iwc.getSessionAttribute(USING_AVAILABLE_USER_PKS_SESSION_PARAMETER); if (useUserPks != null) { this.usingUserPks = true; } Collection availableUserPks = (Collection) iwc.getSessionAttribute(AVAILABLE_USER_PKS_SESSION_PARAMETER); String[] userIds = null; if (this.usingUserPks && availableUserPks != null) { userIds = new String[availableUserPks.size()]; Iterator iter = availableUserPks.iterator(); int counter = 0; while (iter.hasNext()) { Object i = iter.next(); userIds[counter++] = i.toString(); } } if (this.usingUserPks && this.searchString == null) { this.showAll = true; } UserHome uHome = (UserHome) IDOLookup.getHome(User.class); if (this.showAll) { if (this.usingUserPks && userIds != null) { this.users = uHome.findUsers(userIds); } else { this.users = uHome.findAllUsersOrderedByFirstName(); } } else if (this.searchString != null) { this.users = uHome.findUsersBySearchCondition(this.searchString, userIds, false); } } catch (Exception e) { e.printStackTrace(System.err); } }
public String getUserNameDWR(String personalID, String localeStr) { try { if (personalID != null && !personalID.trim().equals("")) { UserHome uHome = (UserHome) IDOLookup.getHome(User.class); User user = uHome.findByPersonalID(personalID); return user.getName(); } else { return ""; } } catch (IDOLookupException e) { e.printStackTrace(); } catch (FinderException e) { } try { IWContext iwc = IWContext.getInstance(); Locale locale = iwc.getCurrentLocale(); IWResourceBundle iwrb = getBundle().getResourceBundle(locale); return iwrb.getLocalizedString("landsmot.user_not_found", "User not found"); } catch (UnavailableIWContext e) { return "User not found"; } }