1 7 package org.exoplatform.services.wsrp.producer.impl.helpers; 8 9 import java.util.Enumeration ; 10 import java.util.List ; 11 import java.util.Map ; 12 import org.apache.commons.lang.StringUtils; 13 import org.exoplatform.commons.utils.IdentifierUtil; 14 import org.exoplatform.services.portletcontainer.helper.BasePortletURL; 15 import org.exoplatform.services.wsrp.WSRPConstants; 16 17 18 22 public class PortletURLImp extends BasePortletURL{ 23 24 private String sessionID; 25 private Map mapToStoreRenderParameters; 26 private String windowID; 27 private String template; 28 29 public PortletURLImp(String type, String markup, 30 List supports, 31 boolean isCurrentlySecured, 32 List customWindowStates, 33 Enumeration supportedWindowState, 34 String template, String windowID, 35 Map mapToStoreRenderParameters, 36 String sessionID){ 37 super(type, markup, supports, isCurrentlySecured, 38 customWindowStates, supportedWindowState); 39 this.template = template; 40 this.windowID = windowID; 41 this.mapToStoreRenderParameters = mapToStoreRenderParameters; 42 this.sessionID = sessionID; 43 } 44 45 public String toString() { 46 String secureInfo ="false"; 47 if(!setSecureCalled && isCurrentlySecured){ 48 isSecure = true; 49 secureInfo = "true"; 50 } 51 52 String navigationalState = IdentifierUtil.generateUUID(this); 53 54 String temp = template; 55 String [] key = StringUtils.split(windowID, "/") ; 56 57 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_URL_TYPE + "}", type); 58 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_MODE + "}", requiredPortletMode.toString()); 59 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_WINDOW_STATE + "}", requiredWindowState.toString()); 60 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_SECURE_URL + "}", secureInfo); 61 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_PORTLET_HANDLE + "}", key[0] + "/" + key[1]); 62 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_PORTLET_INSTANCE_KEY + "}", key[2]); 63 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_NAVIGATIONAL_STATE + "}", navigationalState); 64 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_SESSION_ID + "}", sessionID); 65 66 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_USER_CONTEXT_KEY + "}", ""); 67 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_URL + "}", ""); 68 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_REQUIRES_REWRITE + "}", ""); 69 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_INTERACTION_STATE + "}", ""); 70 temp = StringUtils.replace(temp, "{" + WSRPConstants.WSRP_FRAGMENT_ID + "}", type); 71 72 mapToStoreRenderParameters.put(navigationalState, parameters); 73 74 return temp; 75 } 76 77 78 79 } 80 | Popular Tags |