1 19 20 package com.sslexplorer.webforwards; 21 22 import java.util.List ; 23 24 import javax.servlet.http.HttpServletRequest ; 25 26 import com.sslexplorer.boot.HostService; 27 import com.sslexplorer.boot.Util; 28 import com.sslexplorer.core.CoreUtil; 29 import com.sslexplorer.navigation.RequiresSessionPasswordAbstractFavoriteItem; 30 31 38 public class WebForwardItem extends RequiresSessionPasswordAbstractFavoriteItem { 39 40 42 private String selected; 43 private HostService sslexplorerHost; 44 45 54 public WebForwardItem(WebForward webForward, HostService sslexplorerHost, List policies, boolean requiresPassword) { 55 59 super(webForward, policies, requiresPassword); 60 this.sslexplorerHost = sslexplorerHost; 61 } 62 63 68 public HostService getHost() { 69 return sslexplorerHost; 70 } 71 72 77 public String getLink(int policy, String referer, HttpServletRequest request) { 78 return "/launchWebForward.do?resourceId=" + getWebForward().getResourceId() + "&policy=" + policy + 79 "&returnTo=" + Util.urlEncode(Util.isNullOrTrimmedBlank(referer) ? CoreUtil.getRealRequestURI(request) : referer); 80 } 81 82 87 public String getTypeName() { 88 return ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(this.getWebForward().getType())).getName(); 89 } 90 91 96 public void setSelected(String selected) { 97 this.selected = selected; 98 } 99 100 105 public String getSelected() { 106 return selected; 107 } 108 109 114 public WebForward getWebForward() { 115 return (WebForward) this.getResource(); 116 } 117 118 123 public String getOnClick(int policy, HttpServletRequest request) { 124 return ""; 125 } 126 127 132 public String getTarget() { 133 return "_blank"; 134 } 135 136 141 public String getCategory() { 142 return ((WebForward) this.getResource()).getCategory(); 143 } 144 145 150 public Object getColumnValue(int col) { 151 if (col < 2) { 152 return super.getColumnValue(col); 153 } 154 switch (col) { 155 case 2: 156 return getTypeName(); 157 default: 158 return getCategory(); 159 } 160 } 161 162 167 public String getFavoriteName() { 168 return getResource().getResourceName(); 169 } 170 171 176 public String getFavoriteSubType() { 177 return getTypeName(); 178 } 179 180 185 public String getSmallIconPath(HttpServletRequest request) { 186 return CoreUtil.getThemePath(request.getSession()) + "/images/actions/runWebForward.gif"; 187 } 188 189 194 public String getLargeIconPath(HttpServletRequest request) { 195 return CoreUtil.getThemePath(request.getSession()) + "/images/actions/runWebForwardLarge.gif"; 196 } 197 } | Popular Tags |