1 31 32 package org.opencms.notification; 33 34 import org.opencms.file.CmsResource; 35 36 import java.util.Date ; 37 38 44 public class CmsExtendedNotificationCause implements Comparable { 45 46 47 public static final int RESOURCE_EXPIRES = 0; 48 49 50 public static final int RESOURCE_OUTDATED = 1; 51 52 53 public static final int RESOURCE_UPDATE_REQUIRED = 2; 54 55 56 public static final int RESOURCE_RELEASE = 3; 57 58 59 private int m_cause; 60 61 62 private Date m_date; 63 64 65 private CmsResource m_resource; 66 67 74 public CmsExtendedNotificationCause(CmsResource resource, int cause, Date date) { 75 76 m_resource = resource; 77 m_cause = cause; 78 m_date = date; 79 } 80 81 85 public int compareTo(Object o) { 86 87 if (o instanceof CmsExtendedNotificationCause) { 88 return getDate().compareTo(((CmsExtendedNotificationCause)o).getDate()); 89 } else { 90 return -1; 91 } 92 } 93 94 104 public boolean equals(Object o) { 105 106 if (!(o instanceof CmsExtendedNotificationCause) && !(o instanceof CmsNotificationCause)) { 107 return false; 108 } 109 return hashCode() == o.hashCode(); 110 } 111 112 116 public int hashCode() { 117 118 return m_cause + m_resource.getStructureId().hashCode(); 119 } 120 121 126 public int getCause() { 127 128 return m_cause; 129 } 130 131 136 public Date getDate() { 137 138 return m_date; 139 } 140 141 146 public CmsResource getResource() { 147 148 return m_resource; 149 } 150 151 156 public void setCause(int cause) { 157 158 m_cause = cause; 159 } 160 161 166 public void setDate(Date date) { 167 168 m_date = date; 169 } 170 171 176 public void setResource(CmsResource resource) { 177 178 m_resource = resource; 179 } 180 } 181 | Popular Tags |