1 17 package org.alfresco.repo.domain.hibernate; 18 19 import org.alfresco.repo.domain.Node; 20 import org.alfresco.repo.domain.StoreKey; 21 import org.alfresco.repo.domain.VersionCount; 22 import org.alfresco.service.cmr.repository.StoreRef; 23 24 29 public class VersionCountImpl implements VersionCount 30 { 31 private StoreKey key; 32 private int versionCount; 33 private transient StoreRef storeRef; 34 35 public VersionCountImpl() 36 { 37 versionCount = 0; 38 } 39 40 43 public boolean equals(Object obj) 44 { 45 if (obj == null) 46 { 47 return false; 48 } 49 else if (obj == this) 50 { 51 return true; 52 } 53 else if (!(obj instanceof Node)) 54 { 55 return false; 56 } 57 Node that = (Node) obj; 58 return (this.getKey().equals(that.getKey())); 59 } 60 61 64 public int hashCode() 65 { 66 return getKey().hashCode(); 67 } 68 69 72 public String toString() 73 { 74 return getKey().toString(); 75 } 76 77 public StoreKey getKey() { 78 return key; 79 } 80 81 public synchronized void setKey(StoreKey key) { 82 this.key = key; 83 this.storeRef = null; 84 } 85 86 89 private void setVersionCount(int versionCount) 90 { 91 this.versionCount = versionCount; 92 } 93 94 public int incrementVersionCount() 95 { 96 return ++versionCount; 97 } 98 99 102 public void resetVersionCount() 103 { 104 setVersionCount(0); 105 } 106 107 public int getVersionCount() 108 { 109 return versionCount; 110 } 111 } | Popular Tags |