KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > wsrp > producer > impl > helpers > PortletURLImp


1 /*
2  * Copyright 2001-2003 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  *
5  * Created on 12 janv. 2004
6  */

7 package org.exoplatform.services.wsrp.producer.impl.helpers;
8
9 import java.util.Enumeration JavaDoc;
10 import java.util.List JavaDoc;
11 import java.util.Map JavaDoc;
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 /**
19  * @author Mestrallet Benjamin
20  * benjmestrallet@users.sourceforge.net
21  */

22 public class PortletURLImp extends BasePortletURL{
23
24   private String JavaDoc sessionID;
25   private Map JavaDoc mapToStoreRenderParameters;
26   private String JavaDoc windowID;
27   private String JavaDoc template;
28   
29   public PortletURLImp(String JavaDoc type, String JavaDoc markup,
30                       List JavaDoc supports,
31                       boolean isCurrentlySecured,
32                       List JavaDoc customWindowStates,
33                       Enumeration JavaDoc supportedWindowState,
34                       String JavaDoc template, String JavaDoc windowID,
35                       Map JavaDoc mapToStoreRenderParameters,
36                       String JavaDoc 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 JavaDoc toString() {
46     String JavaDoc secureInfo ="false";
47     if(!setSecureCalled && isCurrentlySecured){
48       isSecure = true;
49       secureInfo = "true";
50     }
51     
52     String JavaDoc navigationalState = IdentifierUtil.generateUUID(this);
53     
54     String JavaDoc temp = template;
55     String JavaDoc[] 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