1 31 32 package org.opencms.test; 33 34 import org.opencms.file.CmsObject; 35 import org.opencms.file.CmsProperty; 36 import org.opencms.file.CmsResource; 37 import org.opencms.file.CmsResourceFilter; 38 import org.opencms.lock.CmsLock; 39 import org.opencms.main.CmsException; 40 import org.opencms.security.CmsAccessControlList; 41 import org.opencms.util.CmsUUID; 42 43 import java.util.ArrayList ; 44 import java.util.Iterator ; 45 import java.util.List ; 46 47 53 public class OpenCmsTestResourceStorageEntry { 54 55 56 protected int m_length; 57 58 59 private List m_accessControlEntries; 60 61 62 private CmsAccessControlList m_accessControlList; 63 64 65 67 68 private byte[] m_contents; 69 70 71 private long m_dateCreated; 72 73 74 private long m_dateExpired; 75 76 77 private long m_dateLastModified; 78 79 80 private long m_dateReleased; 81 82 83 private int m_flags; 84 85 86 private boolean m_isTouched; 87 88 89 private int m_loaderId; 90 91 92 private CmsLock m_lockstate; 93 94 95 private String m_name; 96 97 98 private int m_projectLastModified; 99 100 101 private List m_properties; 102 103 104 private CmsUUID m_resourceId; 105 106 107 private int m_siblingCount; 108 109 110 private int m_state; 111 112 113 private CmsUUID m_structureId; 114 115 116 private int m_type; 117 118 119 private CmsUUID m_userCreated; 120 121 122 private CmsUUID m_userLastModified; 123 124 127 public OpenCmsTestResourceStorageEntry() { 128 } 130 131 139 public OpenCmsTestResourceStorageEntry(CmsObject cms, String resourceName, CmsResource res) throws CmsException { 140 m_dateCreated = res.getDateCreated(); 142 m_dateLastModified = res.getDateLastModified(); 143 m_dateReleased = res.getDateReleased(); 144 m_dateExpired = res.getDateExpired(); 145 m_flags = res.getFlags(); 146 m_isTouched = res.isTouched(); 147 m_length = res.getLength(); 148 m_siblingCount = res.getSiblingCount(); 149 m_name = res.getName(); 150 m_projectLastModified = res.getProjectLastModified(); 151 m_resourceId = res.getResourceId(); 152 m_state = res.getState(); 153 m_structureId = res.getStructureId(); 154 m_type = res.getTypeId(); 155 m_userCreated = res.getUserCreated(); 156 m_userLastModified = res.getUserLastModified(); 157 m_lockstate = cms.getLock(res); 158 if (res.isFile()) { 159 m_contents = cms.readFile(resourceName, CmsResourceFilter.ALL).getContents(); 160 } else { 161 m_contents = null; 162 } 163 164 m_properties = new ArrayList (); 165 List properties = cms.readPropertyObjects(resourceName, false); 166 Iterator i = properties.iterator(); 167 while (i.hasNext()) { 168 CmsProperty prop = (CmsProperty)i.next(); 169 m_properties.add(prop.clone()); 170 } 171 172 m_accessControlList = cms.getAccessControlList(resourceName); 173 m_accessControlEntries = cms.getAccessControlEntries(resourceName); 174 } 175 176 177 182 public List getAccessControlEntries() { 183 return m_accessControlEntries; 184 } 185 186 187 188 193 public CmsAccessControlList getAccessControlList() { 194 return m_accessControlList; 195 } 196 197 202 public byte[] getContents() { 203 return m_contents; 204 } 205 206 207 212 public long getDateCreated() { 213 return m_dateCreated; 214 } 215 216 221 public long getDateExpired() { 222 return m_dateExpired; 223 } 224 225 230 public long getDateLastModified() { 231 return m_dateLastModified; 232 } 233 234 239 public long getDateReleased() { 240 return m_dateReleased; 241 } 242 243 248 251 252 257 public int getFlags() { 258 return m_flags; 259 } 260 261 266 public int getLength() { 267 return m_length; 268 } 269 270 275 public int getLoaderId() { 276 return m_loaderId; 277 } 278 279 284 public CmsLock getLock() { 285 return m_lockstate; 286 } 287 288 289 294 public String getName() { 295 return m_name; 296 } 297 298 304 public String getPath() { 305 return null; 307 } 308 309 314 public int getProjectLastModified() { 315 return m_projectLastModified; 316 } 317 318 319 324 public List getProperties() { 325 return m_properties; 326 } 327 328 329 334 public CmsUUID getResourceId() { 335 return m_resourceId; 336 } 337 338 343 public int getSiblingCount() { 344 return m_siblingCount; 345 } 346 347 348 355 public int getState() { 356 return m_state; 357 } 358 359 364 public CmsUUID getStructureId() { 365 return m_structureId; 366 } 367 368 373 public int getType() { 374 return m_type; 375 } 376 377 382 public CmsUUID getUserCreated() { 383 return m_userCreated; 384 } 385 386 391 public CmsUUID getUserLastModified() { 392 return m_userLastModified; 393 } 394 395 400 public boolean isTouched() { 401 return m_isTouched; 402 } 403 404 405 406 } 407 | Popular Tags |