%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.container.state.impl.SessionFullExtendedNavigationalState |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * 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.container.state.impl; |
|
18 | ||
19 | import org.apache.jetspeed.cache.JetspeedContentCache; |
|
20 | import org.apache.jetspeed.container.PageHistoryValve; |
|
21 | import org.apache.jetspeed.request.RequestContext; |
|
22 | ||
23 | /** |
|
24 | * SessionFullClearOnChangePageNavigationalState, stores all nav parameters in the session, including render parameters |
|
25 | * |
|
26 | * @author <a href="mailto:kmoh.raj@gmail.com">Mohan Kannapareddy</a> |
|
27 | * @version $Id$ |
|
28 | */ |
|
29 | ||
30 | public class SessionFullExtendedNavigationalState extends SessionFullNavigationalState |
|
31 | { |
|
32 | 0 | private boolean clearStateOnPageChangeEnabled = false; |
33 | ||
34 | ||
35 | public SessionFullExtendedNavigationalState(NavigationalStateCodec codec,JetspeedContentCache cache) |
|
36 | { |
|
37 | 0 | super(codec, cache); |
38 | 0 | } |
39 | public SessionFullExtendedNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache) |
|
40 | { |
|
41 | 0 | super(codec, cache, decorationCache); |
42 | 0 | } |
43 | ||
44 | public SessionFullExtendedNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache, boolean clearStateOnPageChangeEnabled) |
|
45 | { |
|
46 | 0 | super(codec, cache, decorationCache); |
47 | 0 | this.clearStateOnPageChangeEnabled = clearStateOnPageChangeEnabled; |
48 | 0 | } |
49 | ||
50 | protected boolean clearPagePortletsModeAndWindowState(RequestContext context) |
|
51 | { |
|
52 | 0 | String contextKey = PageHistoryValve.REQUEST_CLEAR_PORTLETS_MODE_AND_WINDOWSTATE_KEY; |
53 | 0 | boolean result = false; |
54 | 0 | if (clearStateOnPageChangeEnabled) |
55 | { |
|
56 | 0 | Boolean pageNavigationEvent = (Boolean) context.getAttribute(contextKey); |
57 | 0 | if ((pageNavigationEvent != null)) |
58 | { |
|
59 | 0 | result = pageNavigationEvent.booleanValue(); |
60 | } |
|
61 | } |
|
62 | //Just to be safe make it false |
|
63 | 0 | context.setAttribute(contextKey, Boolean.FALSE); |
64 | ||
65 | 0 | return result; |
66 | } |
|
67 | ||
68 | public synchronized void sync(RequestContext context) |
|
69 | { |
|
70 | // JS2-806, check the session for a psuedo inter page navigation. |
|
71 | 0 | boolean resetPagePortlets = false; |
72 | 0 | if (clearStateOnPageChangeEnabled) |
73 | { |
|
74 | 0 | resetPagePortlets = clearPagePortletsModeAndWindowState(context); |
75 | 0 | if (log.isDebugEnabled()) |
76 | { |
|
77 | 0 | log.debug("resetPagePortlets:" + resetPagePortlets); |
78 | } |
|
79 | } |
|
80 | ||
81 | // push the informaion up to SessionNavigationalState, so that we can handle it appropriately there |
|
82 | 0 | setClearPortletsModeAndWindowStateEnabled(resetPagePortlets); |
83 | //Inform the super |
|
84 | 0 | super.sync(context); |
85 | 0 | } |
86 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |