1 5 package org.exoplatform.portlets.content.explorer.component.model; 6 7 import java.io.File ; 8 import java.util.ArrayList ; 9 import java.util.Date ; 10 import java.util.List ; 11 import org.exoplatform.portlets.content.MimeTypeManager; 12 16 public class FileNodeDescriptor implements NodeDescriptor { 17 private String uri_ ; 18 private String parentUri_ ; 19 private String name_ ; 20 private String owner_ ; 21 private MimeTypeManager.MimeType mimeType_ ; 22 private Date createdDate_ ; 23 private Date modifiedDate_ ; 24 private boolean isVersioning_ ; 25 private boolean isLeafNode_ ; 26 private List children_ ; 27 private String cacheContent_ ; 28 29 public FileNodeDescriptor(File node, String uri, String parentUri) { 30 uri_ = uri ; 31 parentUri_ = parentUri; 32 name_ = node.getName() ; 33 owner_ = "N/A" ; 34 Date date = new Date (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 getUri() { return uri_ ; } 48 public String getParentUri() { return parentUri_ ; } 49 public String getName() { return name_ ; } 50 public String getOwner() { return owner_ ; } 51 public Date getModifiedDate() { return modifiedDate_ ; } 52 public Date getCreatedDate() { return createdDate_ ; } 53 public boolean isVersioning() { return isVersioning_ ; } 54 public boolean isLeafNode() { return isLeafNode_ ; } 55 public String getNodeType() { return mimeType_.getMimeType() ;} 56 public String getIcon() { return mimeType_.getIcon() ;} 57 58 public List getChildren() { 59 if(children_ == null) children_ = new ArrayList () ; 60 return children_ ; 61 } 62 63 public void setChildren(List list) { 64 children_ = list ; 65 } 66 67 public String getCacheContent() { return cacheContent_ ; } 68 public void setCacheContent(String s) { cacheContent_ = s ; } 69 } | Popular Tags |