KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > content > explorer > component > model > FileNodeDescriptor


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portlets.content.explorer.component.model;
6
7 import java.io.File JavaDoc;
8 import java.util.ArrayList JavaDoc;
9 import java.util.Date JavaDoc;
10 import java.util.List JavaDoc;
11 import org.exoplatform.portlets.content.MimeTypeManager;
12 /**
13  * @email: tuan08@users.sourceforge.net
14  * @version: $Id: NodeDescriptor.java,v 1.2 2004/11/02 20:02:54 geaz Exp $
15  */

16 public class FileNodeDescriptor implements NodeDescriptor {
17   private String JavaDoc uri_ ;
18   private String JavaDoc parentUri_ ;
19   private String JavaDoc name_ ;
20   private String JavaDoc owner_ ;
21   private MimeTypeManager.MimeType mimeType_ ;
22   private Date JavaDoc createdDate_ ;
23   private Date JavaDoc modifiedDate_ ;
24   private boolean isVersioning_ ;
25   private boolean isLeafNode_ ;
26   private List JavaDoc children_ ;
27   private String JavaDoc cacheContent_ ;
28   
29   public FileNodeDescriptor(File JavaDoc node, String JavaDoc uri, String JavaDoc parentUri) {
30     uri_ = uri ;
31     parentUri_ = parentUri;
32     name_ = node.getName() ;
33     owner_ = "N/A" ;
34     Date JavaDoc date = new Date JavaDoc(node.lastModified()) ;
35     createdDate_ = date ;
36     modifiedDate_ = date ;
37     isVersioning_ = false ;
38     if (node.isFile()) {
39       isLeafNode_ = true ;
40       mimeType_ = MimeTypeManager.getInstance().getMimeTypeByOfFile(name_) ;
41     } else {
42       isLeafNode_ = false ;
43       mimeType_ = MimeTypeManager.getInstance().getDirectoryType() ;
44     }
45   }
46
47   public String JavaDoc getUri() { return uri_ ; }
48   public String JavaDoc getParentUri() { return parentUri_ ; }
49   public String JavaDoc getName() { return name_ ; }
50   public String JavaDoc getOwner() { return owner_ ; }
51   public Date JavaDoc getModifiedDate() { return modifiedDate_ ; }
52   public Date JavaDoc getCreatedDate() { return createdDate_ ; }
53   public boolean isVersioning() { return isVersioning_ ; }
54   public boolean isLeafNode() { return isLeafNode_ ; }
55   public String JavaDoc getNodeType() { return mimeType_.getMimeType() ;}
56   public String JavaDoc getIcon() { return mimeType_.getIcon() ;}
57   
58   public List JavaDoc getChildren() {
59     if(children_ == null) children_ = new ArrayList JavaDoc() ;
60     return children_ ;
61   }
62   
63   public void setChildren(List JavaDoc list) {
64     children_ = list ;
65   }
66   
67   public String JavaDoc getCacheContent() { return cacheContent_ ; }
68   public void setCacheContent(String JavaDoc s) { cacheContent_ = s ; }
69 }
Popular Tags