1 17 package org.alfresco.repo.domain.hibernate; 18 19 import org.alfresco.repo.domain.Node; 20 import org.alfresco.repo.domain.Store; 21 import org.alfresco.repo.domain.StoreKey; 22 import org.alfresco.service.cmr.repository.StoreRef; 23 24 29 public class StoreImpl implements Store 30 { 31 private StoreKey key; 32 private Node rootNode; 33 private transient StoreRef storeRef; 34 35 public StoreImpl() 36 { 37 } 38 39 42 public boolean equals(Object obj) 43 { 44 if (obj == null) 45 { 46 return false; 47 } 48 else if (obj == this) 49 { 50 return true; 51 } 52 else if (!(obj instanceof Node)) 53 { 54 return false; 55 } 56 Node that = (Node) obj; 57 return (this.getKey().equals(that.getKey())); 58 } 59 60 63 public int hashCode() 64 { 65 return getKey().hashCode(); 66 } 67 68 71 public String toString() 72 { 73 return getStoreRef().toString(); 74 } 75 76 public StoreKey getKey() { 77 return key; 78 } 79 80 public synchronized void setKey(StoreKey key) { 81 this.key = key; 82 this.storeRef = null; 83 } 84 85 public Node getRootNode() 86 { 87 return rootNode; 88 } 89 90 public void setRootNode(Node rootNode) 91 { 92 this.rootNode = rootNode; 93 } 94 95 98 public synchronized StoreRef getStoreRef() 99 { 100 if (storeRef == null && key != null) 101 { 102 storeRef = new StoreRef(key.getProtocol(), key.getIdentifier()); 103 } 104 return storeRef; 105 } 106 } | Popular Tags |