1 3 package com.sslexplorer.security; 4 5 import java.util.List ; 6 7 import javax.servlet.http.HttpServletRequest ; 8 9 import com.sslexplorer.core.CoreUtil; 10 import com.sslexplorer.table.TableItem; 11 12 19 public class RoleItem implements TableItem { 20 21 23 private Role role; 24 private List accounts; 25 26 32 public RoleItem(Role role, List accounts) { 33 this.role = role; 34 this.accounts = accounts; 35 } 36 37 41 public List getAccounts() { 42 return accounts; 43 } 44 45 50 public boolean getMultipleAccounts() { 51 return accounts.size() > 1; 52 } 53 54 59 public String getFirstAccountName() { 60 return accounts.size() > 0 ? ((User)accounts.get(0)).getPrincipalName() : ""; 61 } 62 63 68 public Role getRole() { 69 return role; 70 } 71 72 public Object getColumnValue(int col) { 73 switch (col) { 74 case 0: 75 return role.getPrincipalName(); 76 default: 77 return getFirstAccountName(); 78 } 79 } 80 81 84 public String getLink() { 85 return "#"; 86 } 87 88 91 public String getOnClick() { 92 return ""; 93 } 94 95 public String getSmallIconPath(HttpServletRequest request) { 96 return CoreUtil.getThemePath(request.getSession()) + "/images/actions/group.gif"; 97 } 98 99 } 100 | Popular Tags |