source: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/UserQueryResult.java

Last change on this file was 35303, checked in by anupama, 3 years ago
  1. In trying to hunt down where UserTermInfo's toString() and UserQueryResult's toString() get called and what value for groups they need to be displaying (expandedGroups or compactedGroups which is closest to user-entered data), found that UserQueryResult.users was public, despite there being a method getUserTerms() that returns this. So made it a private member and updated code to call the method at all times. In the end I didn't locate anywhere in the code that the aforementioned toString() methods got called, DerbyWrapper.java's db2txt() methods print out the fields direct from the DB in their own formatting, and is called by userDB2txt.java. At the moment, the code is set to print out the expandedGroups for the groups value of any UserTermInfo. 2. Fixed a bug due to oversight in UserTermInfo.java's compactGroups(String groups) and expandedGroups(String groups) to handle when groups is null. Returning empty string then, also used to initialise the compactedGroups and expandedGroups member vars.
File size: 1.7 KB
Line 
1/*
2 * UserQueryResult.java
3 * Copyright (C) 2008 New Zealand Digital Library, http://www.nzdl.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19package org.greenstone.gsdl3.util;
20
21import java.util.Vector;
22import org.greenstone.gsdl3.util.UserTermInfo;
23
24public class UserQueryResult
25{
26 /** the list of UserInfo */
27 private Vector<UserTermInfo> users = null;
28
29 UserQueryResult()
30 {
31 users = new Vector<UserTermInfo>();
32 }
33
34 public void clear()
35 {
36 users.clear();
37 }
38
39 public void addUserTerm(String username, String password, String expandedGroups, String accountstatus, String comment, String email)
40 {
41 UserTermInfo ui = new UserTermInfo(username, password, expandedGroups,
42 accountstatus, comment, email);
43 users.add(ui);
44 }
45
46 public Vector<UserTermInfo> getUserTerms()
47 {
48 return users;
49 }
50
51 public String toString()
52 {
53 String result = "";
54 for (int i = 0; i < users.size(); i++)
55 {
56 result += users.elementAt(i).toString() + ", ";
57 }
58
59 return result;
60 }
61
62 public int getSize()
63 {
64 return users.size();
65 }
66}
Note: See TracBrowser for help on using the repository browser.