1 13 package org.jahia.services.version; 14 15 import java.util.HashMap ; 16 import java.util.HashSet ; 17 import java.util.Set ; 18 19 import org.jahia.content.ObjectKey; 20 21 public abstract class RevisionEntrySet implements Comparable { 22 23 public static final String REVISION_TITLE = "RevisionTitle"; 24 25 private int versionID; 26 private ObjectKey objectKey; 27 28 private HashMap properties = new HashMap (); 30 31 private Set revisions = new HashSet (); 32 33 public RevisionEntrySet(){}; 34 35 40 public RevisionEntrySet(int versionID, ObjectKey objectKey){ 41 this.versionID = versionID; 42 this.objectKey = objectKey; 43 } 44 45 public abstract int getWorkflowState(); 46 47 public abstract int getRevisionType(); 48 49 public abstract String getDescription(String languageCode); 50 51 public int getVersionID(){ 52 return this.versionID; 53 } 54 55 public ObjectKey getObjectKey(){ 56 return objectKey; 57 } 58 59 public Set getRevisions(){ 60 return this.revisions; 61 } 62 63 public void addRevision(RevisionEntry revisionEntry){ 64 if ( revisionEntry != null ) { 65 this.revisions.add(revisionEntry); 66 } 67 } 68 69 public void setProperty(Object name, Object val ){ 70 this.properties.put(name,val); 71 } 72 73 public Object getProperty(Object name){ 74 return this.properties.get(name); 75 } 76 77 84 public String toString(){ 85 StringBuffer buff = new StringBuffer (objectKey.toString()); 86 buff.append("_"); 87 buff.append(getWorkflowState()); 88 buff.append("_"); 89 buff.append(getVersionID()); 90 return buff.toString(); 91 } 92 93 101 public boolean equals(Object object){ 102 103 RevisionEntrySet revisionEntrySet = (RevisionEntrySet)object; 104 if ( revisionEntrySet == null ){ 105 return false; 106 } 107 108 if ( this.getVersionID() != revisionEntrySet.getVersionID() ){ 109 return false; 110 } 111 return (getObjectKey().equals(revisionEntrySet.getObjectKey())); 112 } 113 114 public int hashCode(){ 115 return this.toString().hashCode(); 116 } 117 118 123 public int compareTo(Object o) { 124 return 1; 125 } 126 } 127 | Popular Tags |