mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
118692 jvonka: Merge from DEV/SABRE_JANV1 (part 2) - RA-613 / RA-655 - File Folder API (PoC - experimental WIP) - TODO add tests +review backwards compat' (eg. favs) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126349 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.data.Properties;
|
||||
import org.apache.chemistry.opencmis.commons.data.PropertyData;
|
||||
|
||||
/**
|
||||
* Representation of a document node.
|
||||
@@ -20,31 +37,32 @@ import org.apache.chemistry.opencmis.commons.data.PropertyData;
|
||||
*/
|
||||
public class Document extends Node
|
||||
{
|
||||
// TODO backward compat' - favourites etc
|
||||
private String mimeType;
|
||||
private BigInteger sizeInBytes;
|
||||
private String versionLabel;
|
||||
private String versionLabel;
|
||||
|
||||
public Document()
|
||||
{
|
||||
super();
|
||||
}
|
||||
private ContentInfo contentInfo;
|
||||
|
||||
/*
|
||||
public Document(NodeRef nodeRef, Properties properties)
|
||||
{
|
||||
super(nodeRef, properties);
|
||||
public Document() {
|
||||
super();
|
||||
}
|
||||
|
||||
Map<String, PropertyData<?>> props = properties.getProperties();
|
||||
this.mimeType = (String)getValue(props, PropertyIds.CONTENT_STREAM_MIME_TYPE);
|
||||
this.sizeInBytes = (BigInteger)getValue(props, PropertyIds.CONTENT_STREAM_LENGTH);
|
||||
this.versionLabel = (String)getValue(props, PropertyIds.VERSION_LABEL);
|
||||
}
|
||||
*/
|
||||
public Document(NodeRef nodeRef, NodeRef parentNodeRef, Map<QName, Serializable> nodeProps, ServiceRegistry sr)
|
||||
{
|
||||
super(nodeRef, parentNodeRef, nodeProps, sr);
|
||||
|
||||
public Document(NodeRef nodeRef, Map<QName, Serializable> nodeProps, NamespaceService namespaceService)
|
||||
{
|
||||
super(nodeRef, nodeProps, namespaceService);
|
||||
}
|
||||
Serializable val = nodeProps.get(ContentModel.PROP_CONTENT);
|
||||
|
||||
if ((val != null) && (val instanceof ContentData)) {
|
||||
ContentData cd = (ContentData)val;
|
||||
String mimeType = cd.getMimetype();
|
||||
String mimeTypeName = sr.getMimetypeService().getDisplaysByMimetype().get(mimeType);
|
||||
this.contentInfo = new ContentInfo(mimeType, mimeTypeName, cd.getSize(), cd.getEncoding());
|
||||
}
|
||||
|
||||
//this.versionLabel = (String)nodeProps.get(ContentModel.PROP_VERSION_LABEL);
|
||||
}
|
||||
|
||||
public String getMimeType()
|
||||
{
|
||||
@@ -66,13 +84,16 @@ public class Document extends Node
|
||||
return false;
|
||||
}
|
||||
|
||||
public ContentInfo getContent()
|
||||
{
|
||||
return contentInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Document [mimeType=" + mimeType + ", sizeInBytes="
|
||||
+ sizeInBytes + ", versionLabel=" + versionLabel + ", nodeRef="
|
||||
+ nodeRef + ", name=" + name + ", title=" + title
|
||||
+ ", description=" + description + ", createdAt=" + createdAt
|
||||
return "Document [contentInfo=" + contentInfo.toString() + ", nodeRef="
|
||||
+ nodeRef + ", name=" + name + ", createdAt=" + createdAt
|
||||
+ ", modifiedAt=" + modifiedAt + ", createdBy=" + createdBy
|
||||
+ ", modifiedBy=" + modifiedBy + "]";
|
||||
}
|
||||
|
Reference in New Issue
Block a user