mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126368 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 119796 jvonka: FileFolder API - NodeApiTest - add tests (+ve & -ve) for create folder RA-635 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126713 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,7 @@ import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
@@ -42,15 +43,11 @@ import org.alfresco.service.namespace.QName;
|
||||
* @author janv
|
||||
*
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Document extends Node
|
||||
{
|
||||
private ContentInfo contentInfo;
|
||||
|
||||
// instance init block
|
||||
{
|
||||
this.isFolder = Boolean.FALSE;
|
||||
}
|
||||
|
||||
public Document() {
|
||||
super();
|
||||
}
|
||||
@@ -67,6 +64,8 @@ public class Document extends Node
|
||||
String mimeTypeName = sr.getMimetypeService().getDisplaysByMimetype().get(mimeType);
|
||||
this.contentInfo = new ContentInfo(mimeType, mimeTypeName, cd.getSize(), cd.getEncoding());
|
||||
}
|
||||
|
||||
this.isFolder = false;
|
||||
}
|
||||
|
||||
public ContentInfo getContent()
|
||||
|
@@ -29,6 +29,7 @@ package org.alfresco.rest.api.model;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -39,13 +40,9 @@ import org.alfresco.service.namespace.QName;
|
||||
* @author steveglover
|
||||
* @author janv
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Folder extends Node
|
||||
{
|
||||
// instance init block
|
||||
{
|
||||
this.isFolder = Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Folder()
|
||||
{
|
||||
super();
|
||||
@@ -54,6 +51,7 @@ public class Folder extends Node
|
||||
public Folder(NodeRef nodeRef, NodeRef parentNodeRef, Map<QName, Serializable> nodeProps, Map<String, UserInfo> mapUserInfo, ServiceRegistry sr)
|
||||
{
|
||||
super(nodeRef, parentNodeRef, nodeProps, mapUserInfo, sr);
|
||||
this.isFolder = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -31,11 +31,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -49,6 +50,7 @@ import org.apache.chemistry.opencmis.commons.data.PropertyData;
|
||||
* @author Gethin James
|
||||
* @author janv
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Node implements Comparable<Node>
|
||||
{
|
||||
protected NodeRef nodeRef;
|
||||
@@ -142,15 +144,29 @@ public class Node implements Comparable<Node>
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
private String getNodeRefAsString(NodeRef nRef) {
|
||||
return (nRef != null ? nRef.getId() : null);
|
||||
}
|
||||
|
||||
public void setNodeRef(NodeRef nodeRef)
|
||||
private NodeRef getStringAsNodeRef(String nRefString) {
|
||||
if(! NodeRef.isNodeRef(nRefString))
|
||||
{
|
||||
return new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nRefString);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new NodeRef(nRefString);
|
||||
}
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
this.nodeRef = nodeRef;
|
||||
return getNodeRefAsString(this.nodeRef);
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.nodeRef = getStringAsNodeRef(id);
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
@@ -222,14 +238,14 @@ public class Node implements Comparable<Node>
|
||||
this.aspectNames = aspectNames;
|
||||
}
|
||||
|
||||
public NodeRef getParentId()
|
||||
public String getParentId()
|
||||
{
|
||||
return parentNodeRef;
|
||||
return getNodeRefAsString(parentNodeRef);
|
||||
}
|
||||
|
||||
public void setParentId(NodeRef parentNodeRef)
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentNodeRef = parentNodeRef;
|
||||
this.parentNodeRef = getStringAsNodeRef(parentId);
|
||||
}
|
||||
|
||||
public Boolean getIsFolder()
|
||||
@@ -265,13 +281,13 @@ public class Node implements Comparable<Node>
|
||||
}
|
||||
|
||||
Node node = (Node)other;
|
||||
return EqualsHelper.nullSafeEquals(getNodeRef(), node.getNodeRef());
|
||||
return EqualsHelper.nullSafeEquals(getId(), node.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Node node)
|
||||
{
|
||||
return getNodeRef().toString().compareTo(node.getNodeRef().toString());
|
||||
return getId().toString().compareTo(node.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user