01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.services.information;
18:
19: import java.util.Map;
20:
21: import javax.portlet.PortletMode;
22: import javax.portlet.WindowState;
23:
24: import org.apache.jetspeed.container.url.PortalURL;
25: import org.apache.jetspeed.request.RequestContext;
26: import org.apache.pluto.om.window.PortletWindow;
27: import org.apache.pluto.services.information.PortletURLProvider;
28:
29: /**
30: * Provides access to the Portal URL manipulation
31: *
32: *
33: * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
34: * @version $Id: PortletURLProviderImpl.java 516448 2007-03-09 16:25:47Z ate $
35: */
36: public class PortletURLProviderImpl implements PortletURLProvider {
37: private PortletWindow portletWindow = null;
38: private PortletMode mode = null;
39: private WindowState state = null;
40: private boolean action = false;
41: private boolean secure = false;
42: private Map parameters = null;
43:
44: private PortalURL url;
45:
46: public PortletURLProviderImpl(RequestContext context,
47: PortletWindow portletWindow) {
48: this .portletWindow = portletWindow;
49:
50: url = context.getPortalURL();
51: }
52:
53: public void setPortletMode(PortletMode mode) {
54: this .mode = mode;
55: }
56:
57: public void setWindowState(WindowState state) {
58: this .state = state;
59: }
60:
61: public void setAction() {
62: action = true;
63: }
64:
65: public void setSecure() {
66: secure = true;
67: }
68:
69: public void clearParameters() {
70: // not used, handled by JetspeedNavigationalStateCodec itself
71: }
72:
73: public void setParameters(Map parameters) {
74: this .parameters = parameters;
75: }
76:
77: public String toString() {
78: return url.createPortletURL(portletWindow, parameters, mode,
79: state, action, secure);
80: }
81: }
|