BrightSide Workbench Full Report + Source Code
UserWrapper.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 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 Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.elephant.documents;
19 
20 import org.turro.elephant.security.IUser;
21 
26 public class UserWrapper implements Comparable {
27 
28  private DocumentsBean db;
29  private IUser user;
30 
31  public UserWrapper(DocumentsBean db, IUser user) {
32  this.db = db;
33  this.user = user;
34  }
35 
36  public String getId() {
37  return user.getId();
38  }
39 
40  public String getName() {
41  return user.getName();
42  }
43 
44  public String getSelected() {
45  if(db.isSelected(user)) {
46  return "selected=\"selected\"";
47  }
48  return "";
49  }
50 
51  @Override
52  public int compareTo(Object o) {
53  UserWrapper other = (UserWrapper) o;
54  return getName().compareTo(other.getName());
55  }
56 
57 }
UserWrapper(DocumentsBean db, IUser user)