1 17 package org.alfresco.repo.model.filefolder; 18 19 import java.io.Serializable ; 20 import java.util.Date ; 21 import java.util.Map ; 22 23 import org.alfresco.model.ContentModel; 24 import org.alfresco.service.cmr.model.FileInfo; 25 import org.alfresco.service.cmr.repository.ContentData; 26 import org.alfresco.service.cmr.repository.NodeRef; 27 import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; 28 import org.alfresco.service.namespace.QName; 29 30 35 public class FileInfoImpl implements FileInfo 36 { 37 private NodeRef nodeRef; 38 private boolean isFolder; 39 private Map <QName, Serializable > properties; 40 41 44 FileInfoImpl(NodeRef nodeRef, boolean isFolder, Map <QName, Serializable > properties) 45 { 46 this.nodeRef = nodeRef; 47 this.isFolder = isFolder; 48 this.properties = properties; 49 } 50 51 @Override 52 public String toString() 53 { 54 StringBuilder sb = new StringBuilder (80); 55 sb.append("FileInfo") 56 .append("[name=").append(getName()) 57 .append(", isFolder=").append(isFolder) 58 .append(", nodeRef=").append(nodeRef) 59 .append("]"); 60 return sb.toString(); 61 } 62 63 public NodeRef getNodeRef() 64 { 65 return nodeRef; 66 } 67 68 public boolean isFolder() 69 { 70 return isFolder; 71 } 72 73 public String getName() 74 { 75 return (String ) properties.get(ContentModel.PROP_NAME); 76 } 77 78 public Date getCreatedDate() 79 { 80 return DefaultTypeConverter.INSTANCE.convert(Date .class, properties.get(ContentModel.PROP_CREATED)); 81 } 82 83 public Date getModifiedDate() 84 { 85 return DefaultTypeConverter.INSTANCE.convert(Date .class, properties.get(ContentModel.PROP_MODIFIED)); 86 } 87 88 public ContentData getContentData() 89 { 90 return DefaultTypeConverter.INSTANCE.convert(ContentData.class, properties.get(ContentModel.PROP_CONTENT)); 91 } 92 93 public Map <QName, Serializable > getProperties() 94 { 95 return properties; 96 } 97 } 98 | Popular Tags |