1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 {
51 this.locatorName = locatorName;
52 if (searchPath.endsWith(Folder.PATH_SEPARATOR) && !searchPath.equals(Folder.PATH_SEPARATOR))
53 {
54 this.searchPath = searchPath.substring(0, searchPath.length()-1);
55 }
56 else
57 {
58 this.searchPath = searchPath;
59 }
60 }
61
62 /***
63 * toString - return search path
64 *
65 * @return search path
66 */
67 public String toString()
68 {
69 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 if (obj instanceof String)
80 {
81 return searchPath.equals(obj);
82 }
83 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 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 return locatorName;
104 }
105 }