View Javadoc

1   /*
2    * Copyright 2008 Hippo
3    *
4    * Licensed under the Apache License, Version 2.0 (the  "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" 
12   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  package nl.hippo.client.api.content;
17  
18  import java.io.Serializable;
19  
20  public class Property implements Serializable {
21      
22      private final static long serialVersionUID = 1L;
23  
24  	public final static String DAV_NAMESPACE = "DAV:";
25      public final static String HIPPO_NAMESPACE = "http://hippo.nl/cms/1.0";
26      public final static String HIPPO_WEBDAV_NAMESPACE = "http://hippo.nl/webdav/1.0";
27      public final static String SLIDE_NAMESPACE = "http://jakarta.apache.org/slide/";
28  
29  
30      private final String namespacePrefix;
31      private final String namespaceUri;
32      private final String name;
33      private final String value;
34  
35      public Property(String namespacePrefix, String namespaceUri, String name, String value) {
36          this.namespacePrefix = namespacePrefix;
37          this.namespaceUri = namespaceUri;
38  
39          this.name = name;
40          this.value = value;
41      }
42  
43      public String getNamespacePrefix() {
44          return namespacePrefix;
45      }
46  
47      public String getNamespaceUri() {
48          return namespaceUri;
49      }
50  
51      public String getName() {
52          return name;
53      }
54  
55      public String getValue() {
56          return value;
57      }
58  
59      public String toString() {
60          return new StringBuffer().append("Property [").append("namespacePrefix=").append(namespacePrefix).append(
61                  ", namespaceUri=").append(namespaceUri).append(", name=").append(name).append(", value=").append(value)
62                  .append("]").toString();
63      }
64  
65      public boolean equals(Object obj) {
66          boolean eq;
67          if (obj == null) {
68              eq = false;
69          } else if (!(obj instanceof Property)) {
70              eq = false;
71          } else if (this == obj) {
72              eq = true;
73          } else {
74              Property rhs = (Property) obj;
75              eq = (namespacePrefix.equals(rhs.namespacePrefix) && namespaceUri.equals(rhs.namespaceUri)
76                      && name.equals(rhs.name) && value.equals(rhs.value));
77          }
78          return eq;
79      }
80  
81      public int hashCode() {
82          return new StringBuffer(namespacePrefix).append(namespaceUri).append(name).append(value).toString().hashCode();
83      }
84  
85  }