1 31 32 package org.opencms.flex; 33 34 import org.opencms.file.CmsResource; 35 36 51 public class CmsFlexRequestContextInfo { 52 53 54 private long m_dateExpires; 55 56 57 private long m_dateLastModified; 58 59 62 public CmsFlexRequestContextInfo() { 63 64 m_dateExpires = CmsResource.DATE_EXPIRED_DEFAULT; 66 } 67 68 73 public long getDateExpires() { 74 75 return m_dateExpires; 76 } 77 78 83 public long getDateLastModified() { 84 85 return m_dateLastModified; 86 } 87 88 93 public void merge(CmsFlexRequestContextInfo other) { 94 95 updateDateLastModified(other.getDateLastModified()); 96 updateDateExpires(other.getDateExpires()); 97 } 98 99 104 public void updateDateExpires(long dateExpires) { 105 106 if (dateExpires > System.currentTimeMillis()) { 107 if (dateExpires < m_dateExpires) { 108 m_dateExpires = dateExpires; 109 } 110 } else { 111 updateDateLastModified(dateExpires); 112 } 113 } 114 115 125 public void updateDateLastModified(long dateLastModified) { 126 127 if ((m_dateLastModified > -1) && ((dateLastModified > m_dateLastModified) || (dateLastModified < 0))) { 128 m_dateLastModified = dateLastModified; 129 } 130 } 131 132 139 public void updateDates(long dateLastModified, long dateExpires) { 140 141 updateDateLastModified(dateLastModified); 142 updateDateExpires(dateExpires); 143 } 144 145 154 public void updateFromResource(CmsResource resource) { 155 156 updateDateLastModified(resource.getDateLastModified()); 158 updateDateExpires(resource.getDateReleased()); 160 updateDateExpires(resource.getDateExpired()); 161 } 162 } 163 | Popular Tags |