KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > sharedfolder > model > FileInfo


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2005 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package org.lucane.applications.sharedfolder.model;
21
22 import java.util.Date JavaDoc;
23
24 public class FileInfo implements SharedItem
25 {
26     public static final int NEW_ID = -1;
27     public static final int FIRST_VERSION = 1;
28
29     private int id;
30     private int version;
31     private int parentId;
32     private String JavaDoc name;
33     private String JavaDoc owner;
34     private Date JavaDoc created;
35     private Date JavaDoc modified;
36     private long size;
37     private boolean readable;
38     private boolean writable;
39
40     public FileInfo(int id, int version, int parentId, String JavaDoc name, String JavaDoc owner, Date JavaDoc created, Date JavaDoc modified, long size,
41                     boolean readable, boolean writable)
42     {
43         this.id = id;
44         this.version = version;
45         this.parentId = parentId;
46         this.name = name;
47         this.owner = owner;
48         this.created = created;
49         this.modified = modified;
50         this.size = size;
51         this.readable = readable;
52         this.writable = writable;
53     }
54
55     public FileInfo(int id, int parentId, String JavaDoc name, int version, String JavaDoc owner, long size)
56     {
57         this(id, version, parentId, name, owner, null, null, size, true, true);
58     }
59
60     public boolean isFolder()
61     {
62         return false;
63     }
64
65     public int getId()
66     {
67         return id;
68     }
69
70     public int getVersion()
71     {
72         return version;
73     }
74
75     public void setParentId(int id)
76     {
77         this.parentId = id;
78     }
79
80     public int getParentId()
81     {
82         return parentId;
83     }
84
85     public void setName(String JavaDoc name)
86     {
87         this.name = name;
88     }
89
90     public String JavaDoc getName()
91     {
92         return name;
93     }
94
95     public String JavaDoc getOwner()
96     {
97         return owner;
98     }
99
100     public Date JavaDoc getCreationDate()
101     {
102         return created;
103     }
104
105     public Date JavaDoc getLastModified()
106     {
107         return modified;
108     }
109
110     public void setSize(long size)
111     {
112         this.size = size;
113     }
114
115     public long getSize()
116     {
117         return size;
118     }
119
120     public boolean isReadable()
121     {
122         return readable;
123     }
124
125     public boolean isWritable()
126     {
127         return writable;
128     }
129
130     public String JavaDoc toString()
131     {
132         return "" + parentId + "/" + name + " (" + owner + ":" + size + ", "
133          + created + ":" + modified + ")";
134     }
135 }
Popular Tags