%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.portalsite.view.SiteViewSearchPath |
|
|
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.portalsite.view; |
|
18 | ||
19 | import org.apache.jetspeed.om.folder.Folder; |
|
20 | ||
21 | /** |
|
22 | * This class represents a search path along with a profile |
|
23 | * locator name used to construct the logical site view. The |
|
24 | * profiler locator name is uses to identify and group |
|
25 | * located nodes within the view. |
|
26 | * |
|
27 | * @author <a href="mailto:rwatler@apache.org">Randy Watler</a> |
|
28 | * @version $Id: SiteViewSearchPath.java 517121 2007-03-12 07:45:49Z ate $ |
|
29 | */ |
|
30 | public class SiteViewSearchPath |
|
31 | { |
|
32 | /** |
|
33 | * locatorName - profile locator name |
|
34 | */ |
|
35 | private String locatorName; |
|
36 | ||
37 | /** |
|
38 | * searchPath - search path |
|
39 | */ |
|
40 | private String searchPath; |
|
41 | ||
42 | /** |
|
43 | * SiteViewSearchPath - validating constructor that strips any trailing |
|
44 | * folder separator from search path |
|
45 | * |
|
46 | * @param locatorName profile locator name |
|
47 | * @param searchPath search path |
|
48 | */ |
|
49 | public SiteViewSearchPath(String locatorName, String searchPath) |
|
50 | 0 | { |
51 | 0 | this.locatorName = locatorName; |
52 | 0 | if (searchPath.endsWith(Folder.PATH_SEPARATOR) && !searchPath.equals(Folder.PATH_SEPARATOR)) |
53 | { |
|
54 | 0 | this.searchPath = searchPath.substring(0, searchPath.length()-1); |
55 | } |
|
56 | else |
|
57 | { |
|
58 | 0 | this.searchPath = searchPath; |
59 | } |
|
60 | 0 | } |
61 | ||
62 | /** |
|
63 | * toString - return search path |
|
64 | * |
|
65 | * @return search path |
|
66 | */ |
|
67 | public String toString() |
|
68 | { |
|
69 | 0 | return searchPath; |
70 | } |
|
71 | ||
72 | /** |
|
73 | * equals - compare as string to search path |
|
74 | * |
|
75 | * @return equals result |
|
76 | */ |
|
77 | public boolean equals(Object obj) |
|
78 | { |
|
79 | 0 | if (obj instanceof String) |
80 | { |
|
81 | 0 | return searchPath.equals(obj); |
82 | } |
|
83 | 0 | return searchPath.equals(obj.toString()); |
84 | } |
|
85 | ||
86 | /** |
|
87 | * hashCode - return search path hash code |
|
88 | * |
|
89 | * @return hash code |
|
90 | */ |
|
91 | public int hashCode() |
|
92 | { |
|
93 | 0 | return searchPath.hashCode(); |
94 | } |
|
95 | ||
96 | /** |
|
97 | * getLocatorName - return profile locator name |
|
98 | * |
|
99 | * @return profile locator name |
|
100 | */ |
|
101 | public String getLocatorName() |
|
102 | { |
|
103 | 0 | return locatorName; |
104 | } |
|
105 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |