%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.portlet.webcontent.WebContentHistoryPage |
|
|
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 | ||
18 | package org.apache.jetspeed.portlet.webcontent; |
|
19 | ||
20 | import java.io.Serializable; |
|
21 | import java.util.HashMap; |
|
22 | import java.util.Iterator; |
|
23 | import java.util.Map; |
|
24 | ||
25 | import org.apache.commons.lang.ArrayUtils; |
|
26 | ||
27 | ||
28 | /** |
|
29 | * Information required to re-visit a page in the WebContentPortlet |
|
30 | * |
|
31 | * @author <a href="mailto:dyoung@phase2systems.com">David L Young</a> |
|
32 | * @version $Id: $ |
|
33 | */ |
|
34 | ||
35 | public class WebContentHistoryPage extends Object |
|
36 | implements Serializable |
|
37 | { |
|
38 | private String url; |
|
39 | private Map params; |
|
40 | private boolean is_post; |
|
41 | ||
42 | // Constructors |
|
43 | ||
44 | public WebContentHistoryPage(String url) |
|
45 | { |
|
46 | 0 | this(url, null, class="keyword">null); |
47 | 0 | } |
48 | public WebContentHistoryPage(String url, Map params, String method) |
|
49 | { |
|
50 | 0 | super(); |
51 | ||
52 | // guarantee non-null, so that equals() is well-behaved |
|
53 | 0 | if (url==null) |
54 | 0 | throw new IllegalArgumentException("WebContentHistoryPage() - url required"); |
55 | ||
56 | 0 | this.url = url; |
57 | 0 | this.params = params != null ? params : new HashMap(); |
58 | 0 | this.is_post = method != null && method.equalsIgnoreCase("post"); |
59 | 0 | } |
60 | ||
61 | // Base Class Protocol |
|
62 | ||
63 | public boolean equals(Object o) |
|
64 | { |
|
65 | 0 | if (o == null || !(o instanceof WebContentHistoryPage)) |
66 | 0 | return false ; |
67 | ||
68 | 0 | WebContentHistoryPage page = (WebContentHistoryPage)o; |
69 | ||
70 | 0 | return page.url.equals(this.url) && page.params.equals(class="keyword">this.params) && page.isPost() == class="keyword">this.isPost() ; |
71 | } |
|
72 | public String toString() |
|
73 | { |
|
74 | 0 | StringBuffer buff = new StringBuffer(); |
75 | 0 | buff.append( "[" ).append(isPost() ? "POST: " : "GET: ").append( getUrl() ).append( ", " ).append( getParams().size() ).append(" params: {"); |
76 | 0 | Iterator iter = getParams().entrySet().iterator(); |
77 | 0 | while ( iter.hasNext() ) |
78 | { |
|
79 | 0 | Map.Entry entry = (Map.Entry)iter.next(); |
80 | 0 | buff.append("(").append(entry.getKey()).append(" . ").append(ArrayUtils.toString(entry.getKey())).append(")"); |
81 | 0 | } |
82 | 0 | buff.append("}]"); |
83 | 0 | return buff.toString(); |
84 | } |
|
85 | ||
86 | // Data Access |
|
87 | ||
88 | public String getUrl() |
|
89 | { |
|
90 | 0 | return this.url; |
91 | } |
|
92 | public Map getParams() |
|
93 | { |
|
94 | 0 | return this.params; |
95 | } |
|
96 | public boolean isPost() |
|
97 | { |
|
98 | 0 | return this.is_post; |
99 | } |
|
100 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |