KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > server > filesys > cache > FileState


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.server.filesys.cache;
18
19 import java.io.Serializable JavaDoc;
20
21 import org.alfresco.filesys.server.filesys.FileInfo;
22 import org.alfresco.service.cmr.repository.NodeRef;
23
24 /**
25  * A bean to carry file information and state
26  *
27  * @author Derek Hulley
28  */

29 public class FileState implements Serializable JavaDoc
30 {
31     private static final long serialVersionUID = 4805641599014620793L;
32     
33     /** flag indicating existence */
34     private boolean exists;
35     /** the node being referenced */
36     private NodeRef nodeRef;
37     /** the file info taken from the node */
38     private FileInfo fileInfo;
39     
40     /**
41      * Construct a state for an existing file
42      *
43      * @param nodeRef the node being referenced
44      * @param fileInfo the info taken from the node
45      */

46     public FileState(NodeRef nodeRef, FileInfo fileInfo)
47     {
48         this.exists = true;
49         this.nodeRef = nodeRef;
50         this.fileInfo = fileInfo;
51     }
52     
53     /**
54      * Construct a state for a non-existent file
55      *
56      * @see #exists()
57      */

58     public FileState()
59     {
60         // this.exists = false;
61
// this.nodeRef = null;
62
// this.fileInfo = null;
63
}
64
65     /**
66      * @return Returns a reference to the node in question, provided the node exists
67      */

68     public NodeRef getNodeRef()
69     {
70         return nodeRef;
71     }
72
73     /**
74      * @return Returns the file info retrieved from the node reference, provided the node exists
75      */

76     public FileInfo getFileInfo()
77     {
78         return fileInfo;
79     }
80     
81     public boolean exists()
82     {
83         return exists;
84     }
85 }
86
Popular Tags