001: /*
002: * Lucane - a collaborative platform
003: * Copyright (C) 2005 Vincent Fiack <vfiack@mail15.com>
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019:
020: package org.lucane.applications.sharedfolder.model;
021:
022: import java.util.Date;
023:
024: public class FileInfo implements SharedItem {
025: public static final int NEW_ID = -1;
026: public static final int FIRST_VERSION = 1;
027:
028: private int id;
029: private int version;
030: private int parentId;
031: private String name;
032: private String owner;
033: private Date created;
034: private Date modified;
035: private long size;
036: private boolean readable;
037: private boolean writable;
038:
039: public FileInfo(int id, int version, int parentId, String name,
040: String owner, Date created, Date modified, long size,
041: boolean readable, boolean writable) {
042: this .id = id;
043: this .version = version;
044: this .parentId = parentId;
045: this .name = name;
046: this .owner = owner;
047: this .created = created;
048: this .modified = modified;
049: this .size = size;
050: this .readable = readable;
051: this .writable = writable;
052: }
053:
054: public FileInfo(int id, int parentId, String name, int version,
055: String owner, long size) {
056: this (id, version, parentId, name, owner, null, null, size,
057: true, true);
058: }
059:
060: public boolean isFolder() {
061: return false;
062: }
063:
064: public int getId() {
065: return id;
066: }
067:
068: public int getVersion() {
069: return version;
070: }
071:
072: public void setParentId(int id) {
073: this .parentId = id;
074: }
075:
076: public int getParentId() {
077: return parentId;
078: }
079:
080: public void setName(String name) {
081: this .name = name;
082: }
083:
084: public String getName() {
085: return name;
086: }
087:
088: public String getOwner() {
089: return owner;
090: }
091:
092: public Date getCreationDate() {
093: return created;
094: }
095:
096: public Date getLastModified() {
097: return modified;
098: }
099:
100: public void setSize(long size) {
101: this .size = size;
102: }
103:
104: public long getSize() {
105: return size;
106: }
107:
108: public boolean isReadable() {
109: return readable;
110: }
111:
112: public boolean isWritable() {
113: return writable;
114: }
115:
116: public String toString() {
117: return "" + parentId + "/" + name + " (" + owner + ":" + size
118: + ", " + created + ":" + modified + ")";
119: }
120: }
|