1 5 package org.exoplatform.portlets.content.explorer.component.model; 6 7 import java.util.ArrayList ; 8 import java.util.Date ; 9 import java.util.List ; 10 import javax.jcr.Node; 11 import org.exoplatform.portlets.content.MimeTypeManager; 12 16 public class JCRNodeDescriptor 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 JCRNodeDescriptor(String parentURI, Node node) { 30 name_ = node.getName(); 31 parentUri_ = parentURI ; 32 uri_ = node.getPath() ; 33 String type = node.getPrimaryNodeType().getName() ; 34 if ("/".equals(uri_) || "nt:folder".equals(type)) { 35 isLeafNode_ = false ; 36 mimeType_ = MimeTypeManager.getInstance().getDirectoryType() ; 37 } else { 38 isLeafNode_ = true ; 39 mimeType_ = MimeTypeManager.getInstance().getMimeTypeByOfFile(name_) ; 40 } 41 } 42 43 public String getUri() { return uri_ ; } 44 public String getParentUri() { return parentUri_ ; } 45 public String getName() { return name_ ; } 46 public String getOwner() { return "NA" ; } 47 public Date getModifiedDate() { return null ; } 48 public Date getCreatedDate() { return null ; } 49 public boolean isVersioning() { return isVersioning_ ; } 50 public boolean isLeafNode() { return isLeafNode_ ; } 51 public String getNodeType() { return mimeType_.getMimeType() ;} 52 public String getIcon() { return mimeType_.getIcon() ;} 53 54 public List getChildren() { 55 if(children_ == null) children_ = new ArrayList () ; 56 return children_ ; 57 } 58 59 public void setChildren(List list) { 60 children_ = list ; 61 } 62 63 public String getCacheContent() { return cacheContent_ ; } 64 public void setCacheContent(String s) { cacheContent_ = s ; } 65 } | Popular Tags |