001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/file/history/I_CmsHistoryResource.java,v $
003: * Date : $Date: 2008-02-27 12:05:25 $
004: * Version: $Revision: 1.4 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.file.history;
033:
034: import org.opencms.db.CmsResourceState;
035: import org.opencms.util.CmsUUID;
036:
037: import java.io.Serializable;
038:
039: /**
040: * A historical version of a resource in the OpenCms VFS resource history.<p>
041: *
042: * History resources are resources that contain additional information
043: * used to describe the historical state.<p>
044: *
045: * The historical resource object extends the resource object since it be
046: * an history for a file as well as for a folder.<p>
047: *
048: * History resources contain the names of the users that created or last
049: * modified the resource as string obejcts because a user id might have been
050: * deleted.<p>
051: *
052: * @author Michael Moossen
053: *
054: * @version $Revision: 1.4 $
055: *
056: * @since 6.9.1
057: */
058: public interface I_CmsHistoryResource extends Cloneable, Serializable,
059: Comparable {
060:
061: /**
062: * Returns the history id of this historical resource.<p>
063: *
064: * @return the history id of this historical resource
065: *
066: * @deprecated this field has been removed
067: */
068: CmsUUID getBackupId();
069:
070: /**
071: * Returns the user name of the creator of this historical resource.<p>
072: *
073: * @return the user name of the creator of this historical resource
074: *
075: * @deprecated use {#getUserCreated()} instead
076: * now the {@link org.opencms.file.CmsObject#readUser(CmsUUID)}
077: * also returns historical users
078: */
079: String getCreatedByName();
080:
081: /**
082: * Returns the date of the last modification of the content of this resource.<p>
083: *
084: * @return the date of the last modification of the content of this resource
085: */
086: long getDateContent();
087:
088: /**
089: * Returns the date of the creation of this resource.<p>
090: *
091: * @return the date of the creation of this resource
092: */
093: long getDateCreated();
094:
095: /**
096: * Returns the expiration date this resource.<p>
097: *
098: * @return the expiration date of this resource
099: */
100: long getDateExpired();
101:
102: /**
103: * Returns the date of the last modification of this resource.<p>
104: *
105: * @return the date of the last modification of this resource
106: */
107: long getDateLastModified();
108:
109: /**
110: * Returns the release date this resource.<p>
111: *
112: * @return the release date of this resource
113: */
114: long getDateReleased();
115:
116: /**
117: * Returns the flags of this resource.<p>
118: *
119: * @return the flags of this resource
120: */
121: int getFlags();
122:
123: /**
124: * Returns the name of the user who last changed this historical resource.<p>
125: *
126: * @return the name of the user who last changed this historical resource
127: *
128: * @deprecated use {#getUserLastModified()} instead
129: * with {@link org.opencms.security.CmsPrincipal#readPrincipalIncludingHistory(org.opencms.file.CmsObject, CmsUUID)}
130: */
131: String getLastModifiedByName();
132:
133: /**
134: * Returns the length of the resource.<p>
135: *
136: * If the resource is a file, then this is the byte size of the file content.
137: * If the resource is a folder, then the size is always -1.<p>
138: *
139: * @return the length of the content
140: */
141: int getLength();
142:
143: /**
144: * Returns the name of this resource, e.g. <code>index.html</code>.<p>
145: *
146: * @return the name of this resource
147: */
148: String getName();
149:
150: /**
151: * Returns the structure id of the parent resource.<p>
152: *
153: * @return the structure id of the parent resource
154: */
155: CmsUUID getParentId();
156:
157: /**
158: * Returns the id of the project where the resource has been last modified.<p>
159: *
160: * @return the id of the project where the resource has been last modified, or <code>null</code>
161: */
162: CmsUUID getProjectLastModified();
163:
164: /**
165: * Returns the publish tag of this historical resource.<p>
166: *
167: * @return the publish tag of this historical resource
168: */
169: int getPublishTag();
170:
171: /**
172: * Returns the publish tag of this historical resource.<p>
173: *
174: * @return the publish tag of this historical resource
175: *
176: * @deprecated use {@link #getPublishTag()} instead
177: */
178: int getPublishTagId();
179:
180: /**
181: * Returns the id of the resource database entry of this resource.<p>
182: *
183: * @return the id of the resource database entry
184: */
185: CmsUUID getResourceId();
186:
187: /**
188: * Returns the version number of the resource part for this historical resource.<p>
189: *
190: * @return the version number of the resource part for this historical resource
191: */
192: int getResourceVersion();
193:
194: /**
195: * Returns the name of a resource with it's full path from the root folder
196: * including the current site root,
197: * for example <code>/sites/default/myfolder/index.html</code>.<p>
198: *
199: * @return the name of a resource with it's full path from the root folder
200: * including the current site root
201: */
202: String getRootPath();
203:
204: /**
205: * Returns the number of siblings of the resource, also counting this resource.<p>
206: *
207: * If a resource has no sibling, the total sibling count for this resource is <code>1</code>,
208: * if a resource has <code>n</code> siblings, the sibling count is <code>n + 1</code>.<p>
209: *
210: * @return the number of siblings
211: */
212: int getSiblingCount();
213:
214: /**
215: * Returns the state of this resource.<p>
216: *
217: * @return the state of this resource
218: */
219: CmsResourceState getState();
220:
221: /**
222: * Returns the id of the structure record of this resource.<p>
223: *
224: * @return the id of the structure record of this resource
225: */
226: CmsUUID getStructureId();
227:
228: /**
229: * Returns the version number of the structure part for this historical resource.<p>
230: *
231: * @return the version number of the structure part for this historical resource
232: */
233: int getStructureVersion();
234:
235: /**
236: * Returns the resource type id for this resource.<p>
237: *
238: * @return the resource type id of this resource
239: */
240: int getTypeId();
241:
242: /**
243: * Returns the user id of the user who created this resource.<p>
244: *
245: * @return the user id
246: */
247: CmsUUID getUserCreated();
248:
249: /**
250: * Returns the user id of the user who made the last change on this resource.<p>
251: *
252: * @return the user id of the user who made the last change<p>
253: */
254: CmsUUID getUserLastModified();
255:
256: /**
257: * Returns the version number of this historical resource.<p>
258: *
259: * @return the version number of this historical resource
260: */
261: int getVersion();
262:
263: /**
264: * Returns <code>true</code> if this resource is expired at the given time according to the
265: * information stored in {@link #getDateExpired()}.<p>
266: *
267: * @param time the time to check the expiration date against
268: *
269: * @return <code>true</code> if this resource is expired at the given time
270: *
271: * @see #isReleased(long)
272: * @see #isReleasedAndNotExpired(long)
273: */
274: boolean isExpired(long time);
275:
276: /**
277: * Returns <code>true</code> if the resource is a file, i.e. can have no sub-resources.<p>
278: *
279: * @return true if this resource is a file, false otherwise
280: */
281: boolean isFile();
282:
283: /**
284: * Returns <code>true</code> if the resource is a folder, i.e. can have sub-resources.<p>
285: *
286: * @return true if this resource is a folder, false otherwise
287: */
288: boolean isFolder();
289:
290: /**
291: * Checks if the resource is internal.<p>
292: *
293: * This state is stored as bit 1 in the resource flags.<p>
294: *
295: * @return true if the resource is internal, otherwise false
296: */
297: boolean isInternal();
298:
299: /**
300: * Checks if the link has to be labeled with a special icon in the explorer view.<p>
301: *
302: * This state is stored as bit 2 in the resource flags.<p>
303: *
304: * @return true if a link to the resource has to be labeled, otherwise false
305: */
306: boolean isLabeled();
307:
308: /**
309: * Returns <code>true</code> if this resource is released at the given time according to the
310: * information stored in {@link #getDateReleased()}.<p>
311: *
312: * @param time the time to check the release date against
313: *
314: * @return <code>true</code> if this resource is released at the given time
315: *
316: * @see #isExpired(long)
317: * @see #isReleasedAndNotExpired(long)
318: */
319: boolean isReleased(long time);
320:
321: /**
322: * Returns <code>true</code> if this resource is valid at the given time according to the
323: * information stored in {@link #getDateReleased()} and {@link #getDateExpired()}.<p>
324: *
325: * A resource is valid if it is released and not yet expired.<p>
326: *
327: * @param time the time to check the release and expiration date against
328: *
329: * @return <code>true</code> if this resource is valid at the given time
330: *
331: * @see #isExpired(long)
332: * @see #isReleased(long)
333: */
334: boolean isReleasedAndNotExpired(long time);
335:
336: /**
337: * Returns true if this resource was touched.<p>
338: *
339: * @return boolean true if this resource was touched
340: */
341: boolean isTouched();
342: }
|