1 17 package org.alfresco.repo.domain; 18 19 import java.io.Serializable ; 20 21 import org.alfresco.util.EqualsHelper; 22 23 28 public class NodeKey implements Serializable 29 { 30 private static final long serialVersionUID = 3258695403221300023L; 31 32 private String guid; 33 private String protocol; 34 private String identifier; 35 36 public NodeKey() 37 { 38 } 39 40 public NodeKey(StoreKey storeKey, String guid) 41 { 42 setGuid(guid); 43 setProtocol(storeKey.getProtocol()); 44 setIdentifier(storeKey.getIdentifier()); 45 } 46 47 public NodeKey(String protocol, String identifier, String guid) 48 { 49 setGuid(guid); 50 setProtocol(protocol); 51 setIdentifier(identifier); 52 } 53 54 public String toString() 55 { 56 return ("NodeKey[" + 57 " id=" + guid + 58 ", protocol=" + protocol + 59 ", identifier=" + identifier + 60 "]"); 61 } 62 63 public int hashCode() 64 { 65 return this.guid.hashCode(); 66 } 67 68 public boolean equals(Object obj) 69 { 70 if (this == obj) 71 { 72 return true; 73 } 74 else if (!(obj instanceof NodeKey)) 75 { 76 return false; 77 } 78 NodeKey that = (NodeKey) obj; 79 return (EqualsHelper.nullSafeEquals(this.guid, that.guid) && 80 EqualsHelper.nullSafeEquals(this.protocol, that.protocol) && 81 EqualsHelper.nullSafeEquals(this.identifier, that.identifier) 82 ); 83 } 84 85 public String getGuid() 86 { 87 return guid; 88 } 89 90 93 private void setGuid(String id) 94 { 95 this.guid = id; 96 } 97 98 public String getProtocol() 99 { 100 return protocol; 101 } 102 103 106 private void setProtocol(String protocol) 107 { 108 this.protocol = protocol; 109 } 110 111 public String getIdentifier() 112 { 113 return identifier; 114 } 115 116 119 private void setIdentifier(String identifier) 120 { 121 this.identifier = identifier; 122 } 123 } 124 | Popular Tags |